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
Forum Updated to NodeBB v4.3 + New Features

[solved] Return time in UTC with Qt 4.7

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.2k 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.
  • T Offline
    T Offline
    ThaRez
    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
    • K Offline
      K Offline
      KA51O
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        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.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • T Offline
          T Offline
          ThaRez
          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