Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

"Timer" Stops When PC Clock Adjuseted to Past Time?

  Asked By: Ella    Date: Feb 05    Category: Java    Views: 649
  

I am puzzled with "Timer" and could not find a work around. Can
anyonr help? I have a test code below and it seems to work fine.
However while this is running and adjust the PC clock manually to the
past time lie one hour ago, this timer thread stops to operate. I
want this timer continuously to run. Thank you for your help in
advance.

Timer timer = new Timer(true);
UpdateClockTime task;
task = new UpdateClockTime();
timer.schedule(task, 0L, 1000L);

class UpdateClockTime extends TimerTask {
int cnt;
public UpdateClockTime() {
cnt=0;
}
public void run() {
System.out.println("COUNTER="+cnt);
cnt++;
}
}

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on "Timer" Stops When PC Clock Adjuseted to Past Time? Or get search suggestion and latest updates.




Tagged: