开发者

Can I get a notification if clock changed/adjusted?

I have a program which relies on the clock-time to do some recurring tasks. How can I tell that clock was changed and I need to re开发者_如何学编程-adjust my tasks?

EDIT: I am using a Date instance to see if time already passed or not.


Start a new thread which:

  1. Fetches the current clock time and stores it in a variable V
  2. Sleeps for X milliseconds
  3. Adds X to V, compares it to the current clock time
  4. If the values don't match to within a few milliseconds, assume the clock has changed, and trigger a reschedule
  5. Rinse and repeat
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜