Moodle
  1. Moodle
  2. MDL-26753 DST issues
  3. MDL-12031

After switch from daylight savings to standard time, course>partcipants>activity reports>all logs: graph of hits on course by user shows two Sundays and log entries are shown under wrong day.

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.5, 1.8.3, 1.9, 2.0.7, 2.1.4, 2.2.1, 2.3
    • Fix Version/s: None
    • Component/s: Administration, Reports
    • Labels:
    • Rank:
      16372

      Description

      After switch from daylight savings to standard time (in US, Sunday, 2007-11-04), course>partcipants>activity reports>all logs: graph of hits on course by user shows two Sundays and log entries are shown under wrong day.
      See discussion here for images: http://moodle.org/mod/forum/discuss.php?d=83392
      Note, to reproduce make sure the course start date in which you test is close to the current date to make sure you can see individual days but before the time change so you can see the double days.

      This has effected Moodle sites:
      Moodle versions 1.6.5,1.8.3+(2007-11-01),1.9+(2007-11-01),
      OS Solaris 10 and Linux.

        Issue Links

          Activity

          Hide
          Michael Spall added a comment -

          If you switch the setting Administration>Location>Location settings>Default timezone(timezone) from "Server's local time" to any other setting the graph appears correctly.

          Show
          Michael Spall added a comment - If you switch the setting Administration>Location>Location settings>Default timezone(timezone) from "Server's local time" to any other setting the graph appears correctly.
          Hide
          Michael Spall added a comment -

          Correction:
          If you switch the setting Administration>Location>Location settings>Default timezone(timezone) from "Server's local time" or a setting that uses daylight savings time to a setting that doesn't use daylight savings time, e.g, MST or -7 the graph appears correctly.

          Show
          Michael Spall added a comment - Correction: If you switch the setting Administration>Location>Location settings>Default timezone(timezone) from "Server's local time" or a setting that uses daylight savings time to a setting that doesn't use daylight savings time, e.g, MST or -7 the graph appears correctly.
          Hide
          Joseph Rézeau added a comment -

          Michael,

          Your suggested workaroung may indeed solve the current problem, but then it means that the "country timezones" time system is no longer available on the moodle site.

          I think another, long-term solution should be found, which would allow the use of a country timezone which has a daylight savings time system (such as most European countries) AND does not mess up dates in the logs graph...
          Joseph

          Show
          Joseph Rézeau added a comment - Michael, Your suggested workaroung may indeed solve the current problem, but then it means that the "country timezones" time system is no longer available on the moodle site. I think another, long-term solution should be found, which would allow the use of a country timezone which has a daylight savings time system (such as most European countries) AND does not mess up dates in the logs graph... Joseph
          Hide
          Michael Spall added a comment -

          It also has the problem of showing incorrect times for historical data during the daylight savings periods.

          Show
          Michael Spall added a comment - It also has the problem of showing incorrect times for historical data during the daylight savings periods.
          Hide
          Martin Dougiamas added a comment -

          Is this a regression? I'm almost certain this used to work correctly ...

          Show
          Martin Dougiamas added a comment - Is this a regression? I'm almost certain this used to work correctly ...
          Hide
          Petr Škoda added a comment -

          I doubt it is a regression, I think it depends on version of PHP and combination of timezone/DST.

          Show
          Petr Škoda added a comment - I doubt it is a regression, I think it depends on version of PHP and combination of timezone/DST.
          Hide
          Michael Spall added a comment -

          The PHP versions for our Moodle sites were 5.2.0 and 5.2.4 at the time the issue was filed. The sites with PHP 5.2.4 were updated to PHP 5.2.5 and the issue was still present.

          I have wondered whether the issue is incorrect values in mdl_timezone, specifically in the dst_time and std_time fields.

          Show
          Michael Spall added a comment - The PHP versions for our Moodle sites were 5.2.0 and 5.2.4 at the time the issue was filed. The sites with PHP 5.2.4 were updated to PHP 5.2.5 and the issue was still present. I have wondered whether the issue is incorrect values in mdl_timezone, specifically in the dst_time and std_time fields.
          Hide
          Jonathan Champ added a comment -

          I have attached a patch for Moodle 1.9.11 that correctly calculates the days to show in the drop downs. This resolves the wrong date and wrong log entry date range issues for the activity log. The issue is due to the incorrect assumption that there are 86400 seconds in a day when you are using the user's timezone.

          Show
          Jonathan Champ added a comment - I have attached a patch for Moodle 1.9.11 that correctly calculates the days to show in the drop downs. This resolves the wrong date and wrong log entry date range issues for the activity log. The issue is due to the incorrect assumption that there are 86400 seconds in a day when you are using the user's timezone.
          Hide
          Glenn Ansley added a comment -

          I have taken Jonathan's 1.9.11 patch and updated it for 19_STABLE, 20_STABLE, 21_STABLE, 22_STABLE, and master. I realize 19_STABLE probably won't be integrated but we needed so I include it for others.

          Show
          Glenn Ansley added a comment - I have taken Jonathan's 1.9.11 patch and updated it for 19_STABLE, 20_STABLE, 21_STABLE, 22_STABLE, and master. I realize 19_STABLE probably won't be integrated but we needed so I include it for others.
          Hide
          Dan Poltawski added a comment -

          Hi Glenn,

          Thanks for the work on this.

          I am not intimately familiar with these timezone issues but I am not sure this is the correct solution. Any 'dst' logic which needs to be done in the individual reports feels like the wrong place to me. Are we sure that this can't be done using the the moodlelib functions? If not we might need to add this functionality into the core libraries rather than doing the calculations individually in each plugin.

          Also there is the variable $old_offset - variables with underscores are not permitted in the moodle coding guidelines.

          thanks!

          Show
          Dan Poltawski added a comment - Hi Glenn, Thanks for the work on this. I am not intimately familiar with these timezone issues but I am not sure this is the correct solution. Any 'dst' logic which needs to be done in the individual reports feels like the wrong place to me. Are we sure that this can't be done using the the moodlelib functions? If not we might need to add this functionality into the core libraries rather than doing the calculations individually in each plugin. Also there is the variable $old_offset - variables with underscores are not permitted in the moodle coding guidelines. thanks!
          Hide
          Michael de Raadt added a comment -

          I believe this was tackled in MDL-36380.

          Show
          Michael de Raadt added a comment - I believe this was tackled in MDL-36380 .

            People

            • Votes:
              5 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: