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

QTimeZone is unable to determine the system time zone on Buildroot

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.10
    • Core: Date/Time
    • None
    • 8

      When running a Qt application on Buildroot + Glibc (not uclibc), one gets at startup:

      Unable to determine system time zone: please check your system configuration
      

      I'm not 100% sure, but I think it's due to Buildroot using a "modified" filesystem structure under /usr/share/zoneinfo . Unlike a normal Linux system, on Buildroot all the timezone files are under /usr/share/zoneinfo/posix ; /usr/share/zoneinfo/ contains symlinks to them:

      #  ls -l
      total 72K    
      lrwxrwxrwx    1 root     root          12 Sep 29 08:44 Africa -> posix/Africa
      lrwxrwxrwx    1 root     root          13 Sep 29 08:44 America -> posix/America
      lrwxrwxrwx    1 root     root          16 Sep 29 08:44 Antarctica -> posix/Antarctica
      lrwxrwxrwx    1 root     root          12 Sep 29 08:44 Arctic -> posix/Arctic
      lrwxrwxrwx    1 root     root          10 Sep 29 08:44 Asia -> posix/Asia
      lrwxrwxrwx    1 root     root          14 Sep 29 08:44 Atlantic -> posix/Atlantic
      lrwxrwxrwx    1 root     root          15 Sep 29 08:44 Australia -> posix/Australia
      lrwxrwxrwx    1 root     root          12 Sep 29 08:44 Brazil -> posix/Brazil
      lrwxrwxrwx    1 root     root           9 Sep 29 08:44 CET -> posix/CET
      lrwxrwxrwx    1 root     root          13 Sep 29 08:44 CST6CDT -> posix/CST6CDT
      lrwxrwxrwx    1 root     root          12 Sep 29 08:44 Canada -> posix/Canada
      lrwxrwxrwx    1 root     root          11 Sep 29 08:44 Chile -> posix/Chile
      lrwxrwxrwx    1 root     root          10 Sep 29 08:44 Cuba -> posix/Cuba
      lrwxrwxrwx    1 root     root           9 Sep 29 08:44 EET -> posix/EET
      lrwxrwxrwx    1 root     root           9 Sep 29 08:44 EST -> posix/EST
      lrwxrwxrwx    1 root     root          13 Sep 29 08:44 EST5EDT -> posix/EST5EDT
      lrwxrwxrwx    1 root     root          11 Sep 29 08:44 Egypt -> posix/Egypt
      lrwxrwxrwx    1 root     root          10 Sep 29 08:44 Eire -> posix/Eire
      lrwxrwxrwx    1 root     root           9 Sep 29 08:44 Etc -> posix/Etc
      lrwxrwxrwx    1 root     root          12 Sep 29 08:44 Europe -> posix/Europe
      lrwxrwxrwx    1 root     root          13 Sep 29 08:44 Factory -> posix/Factory
      lrwxrwxrwx    1 root     root           8 Sep 29 08:44 GB -> posix/GB
      lrwxrwxrwx    1 root     root          13 Sep 29 08:44 GB-Eire -> posix/GB-Eire
      lrwxrwxrwx    1 root     root           9 Sep 29 08:44 GMT -> posix/GMT
      lrwxrwxrwx    1 root     root          11 Sep 29 08:44 GMT+0 -> posix/GMT+0
      lrwxrwxrwx    1 root     root          11 Sep 29 08:44 GMT-0 -> posix/GMT-0
      lrwxrwxrwx    1 root     root          10 Sep 29 08:44 GMT0 -> posix/GMT0
      lrwxrwxrwx    1 root     root          15 Sep 29 08:44 Greenwich -> posix/Greenwich
      lrwxrwxrwx    1 root     root           9 Sep 29 08:44 HST -> posix/HST
      lrwxrwxrwx    1 root     root          14 Sep 29 08:44 Hongkong -> posix/Hongkong
      lrwxrwxrwx    1 root     root          13 Sep 29 08:44 Iceland -> posix/Iceland
      lrwxrwxrwx    1 root     root          12 Sep 29 08:44 Indian -> posix/Indian
      lrwxrwxrwx    1 root     root          10 Sep 29 08:44 Iran -> posix/Iran
      lrwxrwxrwx    1 root     root          12 Sep 29 08:44 Israel -> posix/Israel
      lrwxrwxrwx    1 root     root          13 Sep 29 08:44 Jamaica -> posix/Jamaica
      lrwxrwxrwx    1 root     root          11 Sep 29 08:44 Japan -> posix/Japan
      lrwxrwxrwx    1 root     root          15 Sep 29 08:44 Kwajalein -> posix/Kwajalein
      lrwxrwxrwx    1 root     root          11 Sep 29 08:44 Libya -> posix/Libya
      lrwxrwxrwx    1 root     root           9 Sep 29 08:44 MET -> posix/MET
      lrwxrwxrwx    1 root     root           9 Sep 29 08:44 MST -> posix/MST
      lrwxrwxrwx    1 root     root          13 Sep 29 08:44 MST7MDT -> posix/MST7MDT
      lrwxrwxrwx    1 root     root          12 Sep 29 08:44 Mexico -> posix/Mexico
      lrwxrwxrwx    1 root     root           8 Sep 29 08:44 NZ -> posix/NZ
      lrwxrwxrwx    1 root     root          13 Sep 29 08:44 NZ-CHAT -> posix/NZ-CHAT
      lrwxrwxrwx    1 root     root          12 Sep 29 08:44 Navajo -> posix/Navajo
      lrwxrwxrwx    1 root     root           9 Sep 29 08:44 PRC -> posix/PRC
      lrwxrwxrwx    1 root     root          13 Sep 29 08:44 PST8PDT -> posix/PST8PDT
      lrwxrwxrwx    1 root     root          13 Sep 29 08:44 Pacific -> posix/Pacific
      lrwxrwxrwx    1 root     root          12 Sep 29 08:44 Poland -> posix/Poland
      lrwxrwxrwx    1 root     root          14 Sep 29 08:44 Portugal -> posix/Portugal
      lrwxrwxrwx    1 root     root           9 Sep 29 08:44 ROC -> posix/ROC
      lrwxrwxrwx    1 root     root           9 Sep 29 08:44 ROK -> posix/ROK
      lrwxrwxrwx    1 root     root          15 Sep 29 08:44 Singapore -> posix/Singapore
      lrwxrwxrwx    1 root     root          12 Sep 29 08:44 Turkey -> posix/Turkey
      lrwxrwxrwx    1 root     root           9 Sep 29 08:44 UCT -> posix/UCT
      lrwxrwxrwx    1 root     root           8 Sep 29 08:44 US -> posix/US
      lrwxrwxrwx    1 root     root           9 Sep 29 08:44 UTC -> posix/UTC
      lrwxrwxrwx    1 root     root          15 Sep 29 08:44 Universal -> posix/Universal
      lrwxrwxrwx    1 root     root          10 Sep 29 08:44 W-SU -> posix/W-SU
      lrwxrwxrwx    1 root     root           9 Sep 29 08:44 WET -> posix/WET
      lrwxrwxrwx    1 root     root          10 Sep 29 08:44 Zulu -> posix/Zulu
      -rw-r--r--    1 root     root        4.7K Sep  6  2023 iso3166.tab
      -rw-r--r--    1 root     root        5.0K Jan  7  2025 leap-seconds.list
      drwxr-xr-x   18 root     root        4.0K Sep 29 08:44 posix
      drwxr-xr-x   18 root     root        4.0K Sep 29 08:44 right
      -rw-r--r--    1 root     root       18.3K Nov 25  2024 zone.tab
      -rw-r--r--    1 root     root       17.1K Nov 25  2024 zone1970.tab
      -rw-r--r--    1 root     root        7.9K Nov 23  2024 zonenow.tab
      

      (I think this is done to save space but that's beyond the point)

      However the code in https://github.com/qt/qtbase/blob/dev/src/corelib/time/qtimezoneprivate_tz.cpp#L124 seems not to take this into account – one ends up with just the timezones defined in zone.tab , but not necessarily all the ones defined by the filesystem structure.

      For instance Etc/UTC ends up missing (it's only under /usr/share/zoneinfo but not in zone.tab); if /etc/localtime points to that file, Qt will complain.

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

            Eddy Edward Welbourne
            peppe Giuseppe D'Angelo
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes