Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Hardware & Devices
  4. How can I know when the system clock gets adjusted

How can I know when the system clock gets adjusted

Scheduled Pinned Locked Moved Hardware & Devices
question
2 Posts 2 Posters 8 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.
  • D Offline
    D Offline
    davidjaybrown
    wrote on last edited by
    #1

    I need to write a little app that can detect when the system clock gets adjusted. (within limits) In a perfect world, I guess Id like to know what process does the adjustments, but that may be the subject to some follow-on post. Can anyone direct me to some thread here in TheCodeProject? Basically, I need to access the system's TIMECLOCK (the one that is adjustable, and shows me the time in the lower right corner). I also figure I need access to the systems UPTIME CLOCK (that just humms along - regardless of whatever time the TIMECLOCK says). I *think* that what I want to do, is just do an infinite loop where I read the SYSTEMCLOCK, compare it to the previous reading. If its within the limits of time I *expect* to elapse, then all is good. I just sleep another 1000ms or some such, and test again. If I detect that somehow the clock has gone backwards, or jumped forward more than say 1500 ms, then I want to append to some logfile that a time-adjustment has occurred... Can anyone give me some guidance on this? Is this a workable strategy? (I ask because I dont really know what my 'sleep 1000ms' step will do if the clock is adjusted during my sleep... basically, WILL I KNOW if a time adjustment has taken place? (even if its a slight nudge forward or backward). How does this work behind the curtain? Free candy-bar to the guy (or gal) that puts me on the path to elightenment. ;-) Thanks, -Newbie Dave AIM: KewlBean36

    M 1 Reply Last reply
    0
    • D davidjaybrown

      I need to write a little app that can detect when the system clock gets adjusted. (within limits) In a perfect world, I guess Id like to know what process does the adjustments, but that may be the subject to some follow-on post. Can anyone direct me to some thread here in TheCodeProject? Basically, I need to access the system's TIMECLOCK (the one that is adjustable, and shows me the time in the lower right corner). I also figure I need access to the systems UPTIME CLOCK (that just humms along - regardless of whatever time the TIMECLOCK says). I *think* that what I want to do, is just do an infinite loop where I read the SYSTEMCLOCK, compare it to the previous reading. If its within the limits of time I *expect* to elapse, then all is good. I just sleep another 1000ms or some such, and test again. If I detect that somehow the clock has gone backwards, or jumped forward more than say 1500 ms, then I want to append to some logfile that a time-adjustment has occurred... Can anyone give me some guidance on this? Is this a workable strategy? (I ask because I dont really know what my 'sleep 1000ms' step will do if the clock is adjusted during my sleep... basically, WILL I KNOW if a time adjustment has taken place? (even if its a slight nudge forward or backward). How does this work behind the curtain? Free candy-bar to the guy (or gal) that puts me on the path to elightenment. ;-) Thanks, -Newbie Dave AIM: KewlBean36

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      Check out WM_TIMECHANGE. I'll take an Almond Joy please. ;) --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ Strange things are afoot at the U+004B U+20DD

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups