Moodle
  1. Moodle
  2. MDL-38999

Europe/Tallinn current DST information is incorrect in http://download.moodle.org/timezone/

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.10, 2.2.9, 2.3.3, 2.4.3, 2.5
    • Fix Version/s: 2.3.7, 2.4.4
    • Component/s: Libraries
    • Labels:
    • Testing Instructions:
      Hide

      Need to initialize phpunit site to ensure that the fixed timezones are loaded to it:

      • sudo -u (wwwuser) php admin/tool/phpunit/cli/unit.php --drop
      • sudo -u (wwwuser) php admin/tool/phpunit/cli/init.php

      1) TEST: phpunit tests are passing (lib/tests/moodlelib_test.php specifically).

      2) Disable network access, verify you don't have any olson/timezones file in your dataroot/temp directory. The go to admin->location->update timezones and click on "continue". It's possible that you get some curl warning because of the disabled network access.

      3) TEST: must end with 2296 entries imported from dirroot/lib/timezone.txt (double check the source is that, any other is incorrect).

      4) Go to http://www.timeanddate.com/worldclock/city.html?n=242 and you will see the current hour in Tallinn.

      5) TEST: Go to your profile and set your TZ to Europe/Tallinn. Save changes. The last access time must match the time shown @ timeandate.com (with only seconds of difference).

      6) Optionally, repeat 4) and 5) for other timezones (some comments below you will find the problematic ones (pastebin).

      That is all, ciao

      Show
      Need to initialize phpunit site to ensure that the fixed timezones are loaded to it: sudo -u (wwwuser) php admin/tool/phpunit/cli/unit.php --drop sudo -u (wwwuser) php admin/tool/phpunit/cli/init.php 1) TEST: phpunit tests are passing (lib/tests/moodlelib_test.php specifically). 2) Disable network access, verify you don't have any olson/timezones file in your dataroot/temp directory. The go to admin->location->update timezones and click on "continue". It's possible that you get some curl warning because of the disabled network access. 3) TEST: must end with 2296 entries imported from dirroot/lib/timezone.txt (double check the source is that, any other is incorrect). 4) Go to http://www.timeanddate.com/worldclock/city.html?n=242 and you will see the current hour in Tallinn. 5) TEST: Go to your profile and set your TZ to Europe/Tallinn. Save changes. The last access time must match the time shown @ timeandate.com (with only seconds of difference). 6) Optionally, repeat 4) and 5) for other timezones (some comments below you will find the problematic ones (pastebin). That is all, ciao
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull 2.4 Branch:
    • Pull Master Branch:
    • Rank:
      49107

      Description

      The Moodle timezone information database (http://download.moodle.org/timezone/) has an error in it regarding the latest timezone information about Europe/Tallinn. The file currently reads:
      943,Europe/Tallinn,2002,EU,120,0,0,0,0,0,00:00,0,0,0,0,00:00

      Estonia belongs to the EU and has adopted the EU-wide DST (Daylight Saving Time) system since 2002. The http://www.iana.org/time-zones database has the correct information about Europe/Tallinn but for some reason this information is not presented correctly in the Moodle timezone database.

      The correct information should be:
      943,Europe/Tallinn,2002,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00

      Could someone double-check this and fix the Moodle timezone database if this error is confirmed?

        Activity

        Hide
        Petr Škoda added a comment -

        Reassigning to Eloy: do we need to import the new definition somewhere?

        Show
        Petr Škoda added a comment - Reassigning to Eloy: do we need to import the new definition somewhere?
        Hide
        Eloy Lafuente (stronk7) added a comment -

        For reference, last import, using 2013b tz database was performed @ MDL-38668, 2 weeks ago.

        Anyway, I've been looking older versions of timezone.txt and all them have those 2 entries for 1999 and 2002. So it seems to be a persistent problem.

        Going to check with the tz databse... thanks for the report.

        Show
        Eloy Lafuente (stronk7) added a comment - For reference, last import, using 2013b tz database was performed @ MDL-38668 , 2 weeks ago. Anyway, I've been looking older versions of timezone.txt and all them have those 2 entries for 1999 and 2002. So it seems to be a persistent problem. Going to check with the tz databse... thanks for the report.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Update: I'm right now debugging the zones and rules converter from olson files to moodle timezones file... and I think I've found one problem that could lead to the problem with Tallinn (and surely a bunch more).

        Basically, when a rule (EU) that began in year XX has "max" defined as final year... it only applies for that year XX. So if any timezone adhered "EU" after that XX, the rule is not applied to it.

        And the last rule for EU is:

        Rule    EU  1996    max -   Oct lastSun  1:00u  0   -
        

        That would mean that only timezones adhered to the EU rules up to the year 1996 are correctly identified (for example "Europe/Paris" adhered in 1977) and works.

        But "Europe/Tallinn" adhered in 2002 (aka after 1996), so it gets a plain zoneinfo record instead of the EU one still valid.

        I've one alternative version here, correctly evaluating those "max" records... just generating the moodle timezones info and reviewing differences to verify that all them are correct.

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Update: I'm right now debugging the zones and rules converter from olson files to moodle timezones file... and I think I've found one problem that could lead to the problem with Tallinn (and surely a bunch more). Basically, when a rule (EU) that began in year XX has "max" defined as final year... it only applies for that year XX. So if any timezone adhered "EU" after that XX, the rule is not applied to it. And the last rule for EU is: Rule EU 1996 max - Oct lastSun 1:00u 0 - That would mean that only timezones adhered to the EU rules up to the year 1996 are correctly identified (for example "Europe/Paris" adhered in 1977) and works. But "Europe/Tallinn" adhered in 2002 (aka after 1996), so it gets a plain zoneinfo record instead of the EU one still valid. I've one alternative version here, correctly evaluating those "max" records... just generating the moodle timezones info and reviewing differences to verify that all them are correct. Ciao
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Update:

        I've generated the new timezones.txt file with my changes and it reveals 21 differences (Tallinn included).

        Here it's the diff:

        Here it's the new timezones.txt file:

        Here it's the patch:

        Going to perform some manual verifications of the new information by comparing with TZ handling from OS...

        Show
        Eloy Lafuente (stronk7) added a comment - Update: I've generated the new timezones.txt file with my changes and it reveals 21 differences (Tallinn included). Here it's the diff: http://pastebin.com/CUtE7V9V Here it's the new timezones.txt file: https://github.com/stronk7/moodle/commit/f1d628c Here it's the patch: https://github.com/stronk7/moodle/commit/7b14865 Going to perform some manual verifications of the new information by comparing with TZ handling from OS...
        Hide
        Eloy Lafuente (stronk7) added a comment -

        I've tried the 21 changes for datetime 'now' and compared results with http://www.timeanddate.com . The old version was returning various differences and, with the new generated version, the 100% is matching.

        Going to test with with some date in October (6 months in the past), to get them affected by DST when present...

        Show
        Eloy Lafuente (stronk7) added a comment - I've tried the 21 changes for datetime 'now' and compared results with http://www.timeanddate.com . The old version was returning various differences and, with the new generated version, the 100% is matching. Going to test with with some date in October (6 months in the past), to get them affected by DST when present...
        Hide
        Eloy Lafuente (stronk7) added a comment -

        I've tried some more random dates from 6 months ago and all them are matching with the new calculated timezones.txt file.

        Going to try to write some unit-test picking some of the problematic ones and done.

        Marko, it would be great if you can verify various different times with Tallinn, coz it has changed over different rules along the past years...

        Show
        Eloy Lafuente (stronk7) added a comment - I've tried some more random dates from 6 months ago and all them are matching with the new calculated timezones.txt file. Going to try to write some unit-test picking some of the problematic ones and done. Marko, it would be great if you can verify various different times with Tallinn, coz it has changed over different rules along the past years...
        Hide
        Eloy Lafuente (stronk7) added a comment - - edited

        Sending to integration, this includes 3 commits (master):

        • 7b14865d877833000982f6cf27f5236d637a3276 (olson2moodletz changes).
        • f1d628c7b4ceb26ed8b3198d955fd84e0d5cdcda (the fixed timezone.txt file).
        • d506f422c9665c38a702c5a131bf509fd0064ff4 (unit tests covering prev. problems).

        I've added solutions also for 24_STABLE and 23_STABLE, but only including the fixed timezones and the unit tests, not the changes in the conversion tool. We always execute it from master.

        Ciao

        Note: Older versions (22, 21, 20, 19...) will get the fix once this is landed from download.moodle.org automatically (24-36h after roll happens, aprox).

        Show
        Eloy Lafuente (stronk7) added a comment - - edited Sending to integration, this includes 3 commits (master): 7b14865d877833000982f6cf27f5236d637a3276 (olson2moodletz changes). f1d628c7b4ceb26ed8b3198d955fd84e0d5cdcda (the fixed timezone.txt file). d506f422c9665c38a702c5a131bf509fd0064ff4 (unit tests covering prev. problems). I've added solutions also for 24_STABLE and 23_STABLE, but only including the fixed timezones and the unit tests, not the changes in the conversion tool. We always execute it from master. Ciao Note: Older versions (22, 21, 20, 19...) will get the fix once this is landed from download.moodle.org automatically (24-36h after roll happens, aprox).
        Hide
        Dan Poltawski added a comment -

        Hmm, just run the tests and it doesn't love me:

        1) moodlelib_testcase::test_some_moodle_special_dst
        Failed asserting that two strings are identical.
        — Expected
        +++ Actual
        @@ @@
        -2013/04/08 05:00:00
        +2013/04/08 04:00:00

        /Users/danp/git/integration/lib/tests/moodlelib_test.php:1563
        /Users/danp/git/integration/lib/phpunit/classes/advanced_testcase.php:76

        To re-run:
        vendor/bin/php

        Show
        Dan Poltawski added a comment - Hmm, just run the tests and it doesn't love me: 1) moodlelib_testcase::test_some_moodle_special_dst Failed asserting that two strings are identical. — Expected +++ Actual @@ @@ -2013/04/08 05:00:00 +2013/04/08 04:00:00 /Users/danp/git/integration/lib/tests/moodlelib_test.php:1563 /Users/danp/git/integration/lib/phpunit/classes/advanced_testcase.php:76 To re-run: vendor/bin/php
        Hide
        CiBoT added a comment -

        Moving this reopened issue out from current integration. Please, re-submit it for integration once ready.

        Show
        CiBoT added a comment - Moving this reopened issue out from current integration. Please, re-submit it for integration once ready.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        (bet those results are because lack of RTFTI)

        Show
        Eloy Lafuente (stronk7) added a comment - (bet those results are because lack of RTFTI)
        Hide
        Dan Poltawski added a comment -

        Verified it was because I didn't drop and recreate phpunit

        Show
        Dan Poltawski added a comment - Verified it was because I didn't drop and recreate phpunit
        Hide
        Dan Poltawski added a comment -

        Integrated to master, 24 and 23 - thanks Eloy

        Show
        Dan Poltawski added a comment - Integrated to master, 24 and 23 - thanks Eloy
        Hide
        Dan Poltawski added a comment -

        Taking this from Andrew

        Show
        Dan Poltawski added a comment - Taking this from Andrew
        Hide
        Dan Poltawski added a comment -

        Yep, it works. The real amazing thing is that my streaming music kept playing whilst I went offline, despite being confirmed as offline with the message and this error..

        cURL request for "http://download.moodle.org/timezone/" failed with: Could not resolve host: download.moodle.org; nodename nor servname provided, or not known (6)
        line 1329 of /lib/filelib.php: call to debugging()
        line 87 of /admin/tool/timezoneimport/index.php: call to download_file_content()

        Show
        Dan Poltawski added a comment - Yep, it works. The real amazing thing is that my streaming music kept playing whilst I went offline, despite being confirmed as offline with the message and this error.. cURL request for "http://download.moodle.org/timezone/" failed with: Could not resolve host: download.moodle.org; nodename nor servname provided, or not known (6) line 1329 of /lib/filelib.php: call to debugging() line 87 of /admin/tool/timezoneimport/index.php: call to download_file_content()
        Hide
        Dan Poltawski added a comment -

        (hehe, it stopped just after I posted that, damn buffers)

        Show
        Dan Poltawski added a comment - (hehe, it stopped just after I posted that, damn buffers )
        Hide
        Eloy Lafuente (stronk7) added a comment -

        heh

        Show
        Eloy Lafuente (stronk7) added a comment - heh
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Your awesome contributions are now part of Moodle, your fav LMS out there.

        Closing this as fixed.

        Many thanks for all the hard work, ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Your awesome contributions are now part of Moodle, your fav LMS out there. Closing this as fixed. Many thanks for all the hard work, ciao
        Hide
        Marko Puusaar added a comment -

        Thanks for the fix. It works beautifully

        Show
        Marko Puusaar added a comment - Thanks for the fix. It works beautifully
        Hide
        Marko Puusaar added a comment -

        Can anyone comment on when will the changes be reflected at http://download.moodle.org/timezone/ ?

        Show
        Marko Puusaar added a comment - Can anyone comment on when will the changes be reflected at http://download.moodle.org/timezone/ ?
        Hide
        Eloy Lafuente (stronk7) added a comment -

        already, I think. it uses to be < 24h normally.

        Show
        Eloy Lafuente (stronk7) added a comment - already, I think. it uses to be < 24h normally.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: