You are here

function _quiz_format_duration in Quiz 6.4

Same name and namespace in other branches
  1. 8.6 quiz.module \_quiz_format_duration()
  2. 8.4 quiz.module \_quiz_format_duration()
  3. 8.5 quiz.module \_quiz_format_duration()
  4. 7.6 quiz.module \_quiz_format_duration()
  5. 7 quiz.module \_quiz_format_duration()
  6. 7.4 quiz.module \_quiz_format_duration()
  7. 7.5 quiz.module \_quiz_format_duration()
  8. 6.x quiz.module \_quiz_format_duration()

Format a number of seconds to a hh:mm:ss format.

Parameters

$time_in_sec: Integers time in seconds.

Return value

String time in min : sec format.

5 calls to _quiz_format_duration()
quiz_results_manage_results_form in ./quiz.admin.inc
Form for searching after and manipulating results for a quiz
quiz_views_handler_field_time::render in includes/views/handlers/quiz_views_handler_field_time.inc
theme_quiz_get_user_results in ./quiz.pages.inc
Theme the user results page.
theme_quiz_my_results_for_quiz in ./quiz.pages.inc
Theme the user results page.
theme_quiz_view_stats in ./quiz.pages.inc
Theme the stats on the views page

File

./quiz.module, line 4037
Quiz Module

Code

function _quiz_format_duration($time_in_sec) {
  $hours = intval($time_in_sec / 3600);
  $min = intval(($time_in_sec - $hours * 3600) / 60);
  $sec = $time_in_sec % 60;
  if (strlen($min) == 1) {
    $min = '0' . $min;
  }
  if (strlen($sec) == 1) {
    $sec = '0' . $sec;
  }
  return "{$hours}:{$min}:{$sec}";
}