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

QGeoPositionInfo::timestamp() returns non UTC time on iOS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.14.0 Alpha
    • 5.11.3
    • Positioning
    • None
    • iOS/tvOS/watchOS
    • b1e78d739752a044765776a59161809011875a5c (qt/qtlocation/dev)

    Description

      I tested on 5.11.3 but I see the problematic code is the same in 5.13 branch.

      Techinfo:
      Code in qgeopositioninfosource_cl.mm uses default constructor of QDateTime which has default Qt::LocalTime timespec default. Then it call setTime_t (followed by addMSecs).

      https://github.com/qt/qtlocation/blob/5.13/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm#L72

      From the first look the best fix would be to call the following overload instead of setTime_t+addMSecs:

      static QDateTime QDateTime::fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec, int offsetFromUtc = 0);

       

      And pass Qt::UTC timespec.

       

      Attachments

        For Gerrit Dashboard: QTBUG-73651
        # Subject Branch Project Status CR V

        Activity

          People

            tpochep Timur Pocheptsov
            xentrax Vyacheslav Lanovets
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes