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

QTimeZone: offsetFromUtc() return INT_MIN

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Fixed
    • Affects Version/s: 5.12.2
    • Fix Version/s: 5.12.6
    • Component/s: Core: Date/Time
    • Labels:
      None
    • Platform/s:
      Linux/Other display system

      Description

      problem - QTimeZone::offsetFromUtc() return INT_MIN at valid time

      const QTimeZone &timeZone = QTimeZone::systemTimeZone();
      int offsetInSeconds = INT_MIN;
      if (timeZone.isValid()) {
          offsetInSeconds = timeZone.offsetFromUtc(QDateTime::currentDateTime());
          qDebug() << "timeZone" << timeZone << QTimeZone();
          qDebug() << "currentDateTime" << QDateTime::currentDateTime() << QDateTime::currentDateTimeUtc() << "offsetInSeconds" << offsetInSeconds;
      }
      timeZone QTimeZone("Etc/GMT-3") QTimeZone("") 
      currentDateTime QDateTime(2019-12-26 13:32:08.849 +03 Qt::LocalTime) QDateTime(2019-12-26 10:32:08.849 UTC Qt::UTC) offsetInSeconds -2147483648

      information about system

      # date
      Thu Dec 26 13:40:45 +03 2019
      # ls -l /etc/localtime 
      lrwxrwxrwx    1 root     root            25 Dec 26 13:04 /etc/localtime -> /mnt/persistent/localtime
      # ls -l /mnt/persistent/localtime 
      lrwxrwxrwx    1 root     root            29 Dec 26 13:32 /mnt/persistent/localtime -> /usr/share/zoneinfo/Etc/GMT-3
      # ls -l /lib/libc-2.19-2014.08.so 
      -rwxr-xr-x    1 root     root        911388 Dec 26 13:04 /lib/libc-2.19-2014.08.so
      # cat /proc/cpuinfo 
      Processor       : ARMv7 Processor rev 1 (v7l)
      processor       : 0
      BogoMIPS        : 7.52
      
      processor       : 1
      BogoMIPS        : 7.52
      
      processor       : 2
      BogoMIPS        : 7.52
      
      processor       : 3
      BogoMIPS        : 7.52
      
      Features        : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 
      CPU implementer : 0x41
      CPU architecture: 7
      CPU variant     : 0x0
      CPU part        : 0xc05
      CPU revision    : 1
      
      Hardware        : Amlogic Meson8B
      Revision        : 000a
      Serial          : 1b0000000000000

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            Eddy Edward Welbourne
            Reporter:
            imb Kirill Brilliantov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes