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

Scheduled task timing is incorrect when daylight saving time begins

XMLWordPrintable

      This is about scheduled tasks set to run at the hour when the clocks change for daylight saving time. E.g. if a task is set to run at 1am every day in the Europe/London timezone, then the day the clocks go forward gets skipped because 1am doesn't exist on that day.

      There is an existing unit test for this case (scheduled_task_test::test_get_next_scheduled_time) that does catch this issue, however that just tests the current time so it will only test this case once a year if you happen to run your tests at the right time.

      We actually noticed this because the existing unit test breaks when the clocks go backwards. In this case, the test expects the next scheduled time to be the first occurrence of 1am (midnight UTC), however get_next_scheduled_time actually gets the second occurrence of 1am (1am UTC). In this case, get_next_scheduled_time is actually doing the right thing, so the test is wrong.

      So to fix this, we will fix get_next_scheduled_time in the case where the clocks go forward, and we will move the daylight saving time tests into a unit test that doesn't depend on the time when the tests are run.

        1. MDL-84419_404_Step3.png
          MDL-84419_404_Step3.png
          95 kB
        2. MDL-84419_404_Step7.png
          MDL-84419_404_Step7.png
          186 kB
        3. MDL-84419_405_Step3.png
          MDL-84419_405_Step3.png
          87 kB
        4. MDL-84419_405_Step7.png
          MDL-84419_405_Step7.png
          183 kB
        5. MDL-84419_Main_Step3.png
          MDL-84419_Main_Step3.png
          91 kB
        6. MDL-84419_Main_Step7.png
          MDL-84419_Main_Step7.png
          18 kB

            kransom Katie Ransom
            kransom Katie Ransom
            Sam Marshall Sam Marshall
            David Woloszyn David Woloszyn
            Raquel Ortega Raquel Ortega
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 52 minutes
                3h 52m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.