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

timezone: add second-level link /etc/localtime

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • 5.12.5, 5.13.1
    • 5.12.2
    • Core: Date/Time
    • None
    • 4ebac33644d5db0b727680f1dacb18616daafe86 (qt/qtbase/5.12)

    Description

      Many embedded devices use read-only rootfs, at this case usually use intermediate symlink to zoneinfo file.

      Result schema is /etc/localtime -> /tmp/localtime -> /usr/share/zoneinfo/ZONE_FILE

      My solution is

      @@ -1051,7 +1051,12 @@ QByteArray QTzTimeZonePrivate::systemTimeZoneId() const
       
           // On most distros /etc/localtime is a symlink to a real file so extract name from the path
           if (ianaId.isEmpty()) {
      -        const QString path = QFile::symLinkTarget(QStringLiteral("/etc/localtime"));
      +        QString path = QFile::symLinkTarget(QStringLiteral("/etc/localtime"));
      +        if (!path.isEmpty()) {
      +            const QString path2 = QFile::symLinkTarget(path);
      +            if (!path2.isEmpty())
      +                path = path2;
      +        }
               if (!path.isEmpty()) {
                   // /etc/localtime is a symlink to the current TZ file, so extract from path
                   int index = path.indexOf(QLatin1String("/zoneinfo/"));

      Attachments

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

        Activity

          People

            Eddy Edward Welbourne
            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