[concurrency-interest] Re: SynchronizedLong vs. other locks

Tim Peierls tim at peierls.net
Fri Jul 8 11:12:31 EDT 2005

Dawid Kurzyniec wrote:
> Looking at the source code of the GregorianCalendar, it doesn't seem 
> that it has a concept of leap seconds...

So GregorianCalendar is broken -- because, for example, it reports the 
difference in seconds between the first second of 1998-Dec-31 and the first 
second of 1999-Jan-1 as 86400 rather than 86401.

It can't be fixed to deal with leap seconds without breaking existing code, 
so I guess it is safe to rely on its brokenness: computations using 
System.currentTimeMillis() and TimeZone.getOffset will yield the same 
results as GregorianCalendar computations. Yuck.

Seems like the docs should be fixed to make the lack of leap second 
treatment explicit. The Date class says something vague about this, but I 
couldn't draw any conclusions about GregorianCalendar from it.


More information about the Concurrency-interest mailing list