timer
Hi.
I've written a java program that runs in a Windows 2000 environment and has a timer which calculate a lot of things. I observed what I think is sort of weard behaviour. Then I wrote a very simple program to see if I get the same behaviour. I did it.
Observe the program:
mport java.util.Timer;
import java.util.TimerTask;
//
publicclass Principal{
publicstaticvoid main(String[] args){
System.out.print("orloge: ");
Timer orloge =new Timer();
orloge.scheduleAtFixedRate(
new TimerTask(){
publicvoid run(){
System.out.print(".");
}},
2000,
3000);
}
}
It produces a line like this:
orloge: ............
Each point is wirtten each 2 seconds.
If you run this program you will get the same result. No problem.
The weird behaviour begins when you alter the system clock with "date and time properties". If I advance the clock some minutes, the program simply executes the timer task as if it were in a hurry. On the other hand, if I delay the clock some amount time of time, the program will stop until the time gets to the point when it was altered.
It seems that the timer doesn't work on ticks but on "clock time" if you understant me.
I'm still using an old version of java:
D:\Vazio>java -version
java version "1.4.2_14"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_14-b05)
Java HotSpot(TM) Client VM (build 1.4.2_14-b05, mixed mode)
Any help is very welcome.
Ricardo

