we need to keep an eye on the pc clock from a Java program. For this, we schedule a Runnable using scheduleAtFixedRate() every 500 ms. We call System.currentTimeMillis() from this every time. If we see that the there is a bigger difference then 500 ms +- a certain allowed delta, then we assume the clock has changed (then we need to do some other stuff).
Would this be a correct way of doing things? Tests on Linux show that a 50 ms delta is enough during normal operation. On windows, we have to increase it too 100 ms, otherwise, it is thinking the time has changed on every check we do.
Any other ideas on how to do this?