Submitted On 01-MAR-2001
ldlowe
This is far worse than "suboptimal" if we are going to
provide industrial apps written in Java. I'm 26,000 lines
into an application, only to find that updates via an NTP
client to my OS clock are stopping my application's clock
from updating. The best I can figure is that I'm going to
have to provide my clock timer through native code. This is
an ugly solution to what should never have been a problem.
Submitted On 02-MAR-2001
ldlowe
Please ignore the prior comment. When the hour is late, the
midnight oil well and truly burned, the deadlines looming,
and the last two hours were spent chasing why your app
just "unexplicably" stops for no reason, the tempers do
flare. After a well needed rest, the unsolvable turns
trivial, as it nearly always does. For those of you trapped
in a fatigue-induced delirium as I was, your problem is
solved by the Thread.sleep() method. It would still be nice
to have this fixed, however.
Submitted On 26-OCT-2001
IBeaumont
So when clocks change back from Summer time (BST) and move
back an hour - my application will stop scheduling tasks
correctly.
Hardly a solution for industrial strength software.
Submitted On 16-APR-2002
jlscott3
I agree with IBeaumont - daylight savings time breaks the
intended (or at least my desired) functionality of the
Timer class. There's no way to schedule a task to execute
at a specific time each day using Timer. Going to or from
DST will result in execution at the wrong time.
Submitted On 16-MAY-2002
manihss
Can a System.elapsedTimeMillis () be made available ??
Submitted On 22-NOV-2002
georgvs
It's truly unelegant. I would assume that many programmers
have had an issue with this. Elegant solutions are needed,
whether they be custom monitors or listeners on the threads
or other API.
Submitted On 22-SEP-2003
kuehmel
I am using <code>scheduleAtFixedRate(TimerTask task, Date
firstTime, long period)</code> for a recurrent task once a day
(jdk 1.3.0).
It works very vell, if <code>firstTime</code> is in future
when invoking <code>scheduleAtFixedRate</code>. The run-
methode of the task is called once a day at 9 o'clock.
But when it happens that <code>firstTime</code> lays in the
past, when scheduling the task, then the run-method of the
task is called again and again (about 2 times a second).
My workaround is to check the date. If it is in the past, set
the day one day ahead. So it works fine.
Submitted On 02-SEP-2004
langfors
We are developing an 'appliance' type product which uses an appserver and has a gui. One of the features of this appliance is the ability to set the time and timezone of the device via the gui. Needless to say this causes all kinds of havoc as timers are used everywhere, in our code and in the application server's code. We're looking forward to this fix.
Submitted On 20-JUN-2005
CypherJF
This appears to still exist in
java version "1.5.0_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)
Windows platform.
Submitted On 03-MAY-2006
g8julieh
This appears to still exist in
JDK1.5.0_06
Submitted On 16-MAR-2007
yovn
Here is a way to fix it:http://yovn.spaces.live.com/blog/cns!D38F6783B957A08A!164.entry
Submitted On 25-MAY-2007
Can we have another method to cater for system change time; for example if the summar time starts and the clock is moved back one hour, there should be an interface which gets a call back from the JVM to inform about new dates and any running timer which implement this interface will get notified to take appropriate actions. There should be a spec changes
Submitted On 25-MAY-2007
Can we have another method to cater for system time change; for example if the summar time starts and the clock is moved back one hour, there should be an interface which gets a call back from the JVM to inform about new datetime so that any running timer which implements this interface will get notified to take appropriate actions. There should be a spec changes to take into consideration the system time change in relation to the scheduled activities on the sytem.
Regards,
Alan Mehio
London, UK
Submitted On 11-AUG-2007
Since anything based on System.currentTimeMillis() is subject to such issues and System.nanoTime() is substantively more expensive, it would seem like there are grounds for simply using a different API if this is a concern.
To that end, do ScheduledExecutorService implementations have this issue? If not, why not use them instead?
Submitted On 21-AUG-2007
backstabb
Date starting_date = new Date() ;
...
Date current_date = new Date() ;
if (current_date.before( starting_date_)
setSomethingIsWrongFlag(true);
Submitted On 01-OCT-2007
daylight saving has nothing to do with the bug.
Submitted On 06-APR-2008
desd1012
We too have an appliance that can let the user set time. Let me tell you this: there is so many loops, timer and code that is absolute-time dependant, that we decided to stop all of them when a user (or NTP) changes the time by more than X seconds. This is an application-wide constraint, and the entire design has to factor in time shifts.
Guy, not only timers are affected. Think about your rolling data, the timestamps in it, and how you have to react to gaps of time (shifting in future) or overlapping system time (shifting in past).... This nightmare is my life since 2003...
It usually ends up in release notes as a limitation of the software. All we can do is have a consistent, coherent, homogen behavior when facing time shifts. Good luck.
We even though of putting some new concept of 'age' provider API; a method that would guaranty a monotonically ascending long value, like the above suggested System.elapsedTime(). That's a start. But we wanted more than the 'age' of the JVM, we wanted the 'age' of the computer, or at least the age of the software installation.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|