diff --git a/mod/quiz/jstimer.php b/mod/quiz/jstimer.php index b88977fe907..1a0d7641a39 100644 --- a/mod/quiz/jstimer.php +++ b/mod/quiz/jstimer.php @@ -12,6 +12,12 @@ var timesup = ""; var quizclose = timeclose - time()) - $timerstartvalue; ?>; // in seconds var quizTimerValue = ; // in seconds parseInt(quizTimerValue); + +// @EC PF : client time when page was opened +var ec_page_start = new Date().getTime(); +// @EC PF : client time when quiz should end +var ec_quiz_finish = ec_page_start + ; + // --> diff --git a/mod/quiz/timer.js b/mod/quiz/timer.js index bdb9e960fe5..a45284424ab 100644 --- a/mod/quiz/timer.js +++ b/mod/quiz/timer.js @@ -6,7 +6,12 @@ // function countdown_clock(theTimer) { var timeout_id = null; - quizTimerValue = quizTimerValue - 1; + + // @EC PF : current client time + var ec_now_epoch = new Date().getTime(); + + // @EC PF : time left according to client + quizTimerValue = Math.floor( (ec_quiz_finish - ec_now_epoch) /1000 ); if(quizTimerValue == 0) { clearTimeout(timeout_id);