Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-39246

Better synchronise times on the server with times in the browser (e.g. quiz timer)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.6, 2.4.3
    • Fix Version/s: 2.4.4, 2.5
    • Component/s: JavaScript, Quiz
    • Labels:
    • Testing Instructions:
      Hide

      1. Create a quiz with a time-limit.
      2. Start an attempt at that quiz.
      3. Verify that the count-down timer starts with the right amount of time left.
      4. View page source, and verify that the code "M.pageloadstarttime = new Date();" appears near the start of <head>.

      Show
      1. Create a quiz with a time-limit. 2. Start an attempt at that quiz. 3. Verify that the count-down timer starts with the right amount of time left. 4. View page source, and verify that the code "M.pageloadstarttime = new Date();" appears near the start of <head>.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      If you try to initialise a timer in the browser by using yui_module or js_init_call, then there the timer will not acutally start running until those script files have loaded, which could be a delay of several seconds.

      It would be better to capture the current time ASAP in <head> using some inline JS like
      M.pageloadstarttime = Date();

      That lets client-side JS get a timestamp that is as close as possible to when Moodle served the page.

      We need this in the quiz module to set make the count-down timer as accurate as possible.

        Attachments

          Activity

            People

            Assignee:
            timhunt Tim Hunt
            Reporter:
            timhunt Tim Hunt
            Peer reviewer:
            Andrew Lyons Andrew Lyons
            Integrator:
            Damyon Wiese Damyon Wiese
            Tester:
            Damyon Wiese Damyon Wiese
            Participants:
            Component watchers:
            Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              13/May/13