Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-53071

QTimeZone mishandles tzdata 2016b and later in Russia, Kazakhstan

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.6.2, 5.7.1
    • 5.6.0
    • Core: Date/Time
    • None
    • Fedora 23 x86-64, with tzdata 2016d-1.fc23 and qt5-qtbase-devel 5.6.0-9.fc23 installed.
    • e9041c7fc1052167f1ec2df0ea9623059e55d00f

    Description

      Starting in version 2016b, the tz database has included time zones like Asia/Barnaul that generate time stamps with numeric abbreviations, e.g., "Sun Mar 27 03:00:00 2016 +07" in Barnaul for the same instant of time as "Sat Mar 26 20:00:00 2016 UTC" in Universal Time. POSIX.1-2001 introduced these abbreviations and they are supported by standard C libraries on POSIXish platforms.

      Apparently Qt does not work with these abbreviations when Qt decodes tz binary files. This is causing problems in the field with Plasma Digital Clock users in Russia and Kazakhstan; for example, see <http://mm.icann.org/pipermail/tz/2016-April/023605.html>.

      I looked into the Qt source code, and see a bug that may explain the problem: POSIX.1-2001 allows digits, '+' and '-' in time zone abbreviations, when the abbreviation is surrounded by angle brackets. The new tzdata assumes POSIX.1-2001 or later for a few zones; for example, in Asia/Barnaul it puts the equivalent of TZ='<+07>-7' at the end of the tzdata binary file, and this value conforms to POSIX.

      The buggy Qt code appears to be in qt5/qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp, around line 430, where the code insists on only letters in the time zone abbreviation.

      To reproduce the problem run the attached program. The correct output should be '"+07" 25200 QDateTime(2016-04-01 01:00:00.000 +07 Qt::TimeSpec(TimeZone) Asia/Barnaul)'. Instead, Qt outputs '"" 0 QDateTime(2016-03-31 18:00:00.000 Qt::TimeSpec(TimeZone) Asia/Barnaul)'.

      Attachments

        1. Console.pro
          0.1 kB
        2. main.cpp
          0.5 kB
        For Gerrit Dashboard: QTBUG-53071
        # Subject Branch Project Status CR V

        Activity

          People

            thiago Thiago Macieira
            eggert Paul Eggert
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes