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]Time of day in milliseconds using QDateTime::toMSecsSinceEpoch();

[solved]Time of day in milliseconds using QDateTime::toMSecsSinceEpoch();

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 13.3k 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.
  • M Offline
    M Offline
    Mr.Floppy
    wrote on last edited by
    #1

    Hi!

    I need to know the time of day in milliseconds.
    Basically the value of a counter, that starts every day at 0ms and ends at 86400000ms.

    My idea is simple enough:
    Take the present QDateTime::toMSecsSinceEpoch(); timestamp and subtract the timestamp from tonight at 00:00:00,000... but how do I get the MSecsSinceEpoch of a certain point in the past?

    There has to be an easy way, I just havn't found it yet...

    Cheers,
    schmaunz

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      Hi, try
      QDateTime::currentMSecsSinceEpoch() - QDateTime(QDate::currentDate()).toMSecsSinceEpoch();

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mr.Floppy
        wrote on last edited by
        #3

        [quote author="hskoglund" date="1402587810"]
        QDateTime::currentMSecsSinceEpoch() - QDateTime(QDate::currentDate()).toMSecsSinceEpoch();
        [/quote]

        That is exactly what I was looking for.
        Thank you very much :)

        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