You are here

function theme_getid3_duration in getID3() 7.2

Same name and namespace in other branches
  1. 7 getid3.module \theme_getid3_duration()

Format a float duration into minutes:seconds.

Parameters

$variables: Array with 'duration' key.

1 theme call to theme_getid3_duration()
getid3_tokens in ./getid3.tokens.inc
Implements hook_tokens().

File

./getid3.module, line 295

Code

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