I agree that a poorly configured system clock is not something Tomcat is
responsible for, per se. However, there is a problem in the following
code as I see it, which can be easily fixed by checking also for a
negative number. This is a small fix that caters for people being dumb:
/**
* Get the current date in HTTP format.
*/
public static final String getCurrentDate() {
long now = System.currentTimeMillis();
if ((now - currentDateGenerated) > 1000) {
synchronized (format) {
if ((now - currentDateGenerated) > 1000) {
currentDate = format.format(new Date(now));
currentDateGenerated = now;
}
}
}
return currentDate;
}
I also think that looking at this code, if clocks go back at, say, 2am in
a given time zone, Tomcat will report 2am in an HTTP header continually
for 1 hour.
Am I wrong?
Thanks,
Mick
On 26/08/2011 17:10, "Christopher Schultz" <[email protected]>
wrote:
>Mark and Mick,
>
>On 8/26/2011 11:45 AM, Mark Thomas wrote:
>> The fix is to address the root cause which appears to be a poorly
>> configured system clock. I am loath to add a work-around at any point in
>> the Tomcat source code to handle time apparently going backwards rather
>> than forwards.
>
>+1
>
>This is not something that should happen on a stable server. DST
>adjustments will not cause Tomcat to report the same Date header for an
>hour (or whatever it is in your time zone) after DST rolls back.
>
>-chris
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]