You are here

function theme_filefield_meta_duration in FileField 6.3

Convert the float duration into a pretty string.

Parameters

$duration:

1 theme call to theme_filefield_meta_duration()
filefield_meta_handler_field_duration::render in filefield_meta/includes/filefield_meta_handler_field_duration.inc

File

filefield_meta/filefield_meta.module, line 188
FileField Meta: Add Video Support to File Field.

Code

function theme_filefield_meta_duration($duration) {
  $seconds = round(($duration / 60 - floor($duration / 60)) * 60);
  $minutes = floor($duration / 60);
  if ($seconds >= 60) {
    $seconds -= 60;
    $minutes++;
  }
  return intval($minutes) . ':' . str_pad($seconds, 2, 0, STR_PAD_LEFT);
}