[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GregorianCalendar doesn't work with large +ve/-ve time values
From: |
Stephen Crawley |
Subject: |
GregorianCalendar doesn't work with large +ve/-ve time values |
Date: |
Wed, 13 Oct 2004 11:02:44 +1000 |
Folks,
There has been a fair bit of discussion about Date-related bugs
recently. I'd like to draw your attention to the long-standing #9495
bug against java.util.GregorianCalendar which fails when you try
to convert a large +ve or -ve millisecond value to a Date.
There is a new(-ish) Mauve testcase that exercises GregorianCalendar
millisecond conversion across its range of input values:
gnu.testlet.java.util.GregorianCalendar.conversion.java
The root cause of the bug is that the conversion calculations are done
using 'int' instead of 'long'. For large millisecond values, some of
the calculations are wrapping around.
-- Steve