> If the system clock is changed backward or forward what is the expected
> result on calls like Object.wait, Thread.sleep and scheduled timers in Java
> 1.5?
It shouldn't do.
Having said that, the specification is loose. There is no guarantee on
the accuracy of the interval. 1.5 clarifies the specification of wait to
allow it to return spuriously, even without an interval set.
> Does the underlying implementation use System.currentTimeMillis or similar
> or does it count the clock ticks?
1.5 has System.nanoTime, which again shouldn't be upset by changes in
the system clock.
java.util.Timer and, IIRC, javax.swing.Timer use
System.currentTimeMillis, so may exhibit incorrect behaviour.
> Is it hardware or OS dependent?
Bugs can be. I found (on, IIRC, Fedora Core 4 on a PII) that
System.nanoTime jumped about when I changed the system clock.
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
>If the system clock is changed backward or forward what is the expected
>result on calls like Object.wait, Thread.sleep and scheduled timers in Java
>1.5?
it screws up! Timers work by recording the wakeup absolute time.
I ran into this problem writing setclock, which resets your clock. See
http://mindprod.com/webstarts/setclock.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Eric Sosman - 10 Feb 2006 22:07 GMT
Roedy Green wrote On 02/10/06 16:48,:
>>If the system clock is changed backward or forward what is the expected
>>result on calls like Object.wait, Thread.sleep and scheduled timers in Java
[quoted text clipped - 4 lines]
> I ran into this problem writing setclock, which resets your clock. See
> http://mindprod.com/webstarts/setclock.html
For all the derision directed at (Open)VMS, this is
something it did/does better than the systems that have
largely supplanted it. Times could be stated as "absolute"
or "relative;" the former were affected by changes to the
system clock while the latter were not. You used whichever
made sense for the need at hand: absolute for "at noon,"
relative for "ten-second timeout."

Signature
Eric.Sosman@sun.com
P.Hill - 14 Feb 2006 05:14 GMT
>>If the system clock is changed backward or forward what is the expected
>>result on calls like Object.wait, Thread.sleep and scheduled timers in Java
[quoted text clipped - 4 lines]
> I ran into this problem writing setclock, which resets your clock. See
> http://mindprod.com/webstarts/setclock.html
Technically SNTP does NOT push time into the past. It slews the time
slowly, see an old page I wrote on that subject.
http://www.xmission.com/~goodhill/dates/increasingmillisecond.html
I'm not sure what that means for setting the clock via Java...
-Paul