Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved] Return time in UTC with Qt 4.7
Qt 6.11 is out! See what's new in the release blog

[solved] Return time in UTC with Qt 4.7

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello
    How can I return the current time in UTC with Qt 4.7? The following code:

    @QTime::currentTime(Qt::UTC);@

    causes the following error:

    error: no matching function for call to 'QTime::currentTime(Qt::TimeSpec)'
    qt-4.7.3/include/QtCore/qdatetime.h:183: note: candidates are: static QTime QTime::currentTime()

    Thanks!
    Richard

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      @QDateTime::currentDateTimeUtc().time()@

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        To cite the docs of [[Doc:QTime]]:

        bq. Unlike QDateTime, QTime knows nothing about time zones or daylight savings time (DST).

        So, I would suggest to use "QDateTime::currentDateTimeUtc() ":/doc/qt-4.8/qdatetime.html#currentDateTimeUtc instead.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          Thank you!

          • Richard
          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved