[concurrency-interest] Re: SynchronizedLong vs. other locks
dawidk at mathcs.emory.edu
Fri Jul 8 11:08:17 EDT 2005
Tim Peierls wrote:
> Tim Peierls wrote:
>> Answering my own question: No, it doesn't. The program below produces
>> this output on my machine (today):
>> t1 = 1120881600000
>> t2 = 1120867200000
>> a difference of 4 minutes. (Hmm, why four minutes? Only 23 leap
>> seconds have been inserted since the epoch.)
> Ah, four *hours*! That's the time zone difference. Sorry.
> But can one always count on System.currentTimeMillis() in this way?
Looking at GregorianCalendar.computeFieldsImpl(), it is clear that
GregorianCalendar ignores leap seconds, so it seems safe to replace it
with that arithmetics. (BTW. the arithmetics work correctly only for
positive "currentTimeMillis", e.g. after 1970. I don't suppose it
matters in the discussed application, though).
More information about the Concurrency-interest