Results 1 to 6 of 6

Thread: detect system time change

  1. #1
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default detect system time change

    I want to detect the event when the system clock changes. I am working on windows.
    If there is not any way in Qt, please guide me where to find a way

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,709
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: detect system time change

    I don't if there is such an event.
    But what you can do, is have a timer call a slot every half a second and get the system time.
    If the time has changed in more then one second, you know someone has changed the system time.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: detect system time change

    thank u alot
    this will be my last choice
    any more intelligent way ?

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: detect system time change

    Sure, but the more intelligent ways will add a lot of OS-specific code to your project. By far the easiest to implement and least OS-specific way is to just query the time once a second and check yourself.

  5. #5
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: detect system time change

    thank u both , I will do it

  6. #6
    Join Date
    Sep 2013
    Posts
    11
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Windows Android

    Default Re: detect system time change

    there is an event in linux when the time changes using external sources or an app, see this link, may be there is something similar in windows
    https://lkml.org/lkml/2010/9/16/405

Similar Threads

  1. how to get the current system time ?
    By Petr_Kropotkin in forum General Programming
    Replies: 4
    Last Post: 10th February 2010, 19:21
  2. How to change the date and time of a system
    By augusbas in forum Qt Programming
    Replies: 1
    Last Post: 23rd June 2009, 06:55
  3. QTimer stops after system time change
    By djurodrljaca in forum Qt Programming
    Replies: 3
    Last Post: 1st May 2009, 21:36
  4. System time changed event
    By varunjajee in forum Qt Programming
    Replies: 2
    Last Post: 8th April 2009, 07:05
  5. displaying system time
    By aj2903 in forum Newbie
    Replies: 4
    Last Post: 2nd December 2008, 07:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.