How can I know when the system clock gets adjusted
-
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
-
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
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