function _video_sec2hms in Video 6.2
Same name and namespace in other branches
- 5 video.module \_video_sec2hms()
- 6 video.module \_video_sec2hms()
Convert seconds to hours, minutes, and seconds. Derived from h:m:s example by Jon Haworth
@link http://www.laughing-buddha.net/jon/php/sec2hms/
Parameters
$sec: integer value of seconds.
Return value
array associative with key values of hours, minutes, and seconds.
2 calls to _video_sec2hms()
- video_form in ./
video.module - Hook, displays the contents of the node form page for creating and editing nodes.
- _video_playtime_seconds in views/
video_views_handler_field_playtime_seconds.inc - Handler to to render the correct playtime for the video in a field
File
- ./
video.module, line 1371 - video.module
Code
function _video_sec2hms($sec = 0) {
$hms = array();
// 3600 seconds in an hour and trash remainder
$hms['hours'] = intval(intval($sec) / 3600);
// dividing the total seconds by 60 will give us
// the number of minutes, but we're interested in
// minutes past the hour: to get that, we need to
// divide by 60 again and keep the remainder
$hms['minutes'] = intval($sec / 60 % 60);
$hms['seconds'] = intval($sec % 60);
//keep the remainder.
return $hms;
}