Second Class Converts Date Wrong near Daylight Savings Switch
howlettga opened this issue · 0 comments
howlettga commented
The org.jfree.data.time.Second constructor takes a Date object. However it converts the Date object to a Second object incorrectly around around the time daylight savings switches. Take the following code:
Date date = new Date(1667711700*1000); // unix epoch timestamp
Second second = new Second(date);
System.out.println(date.toString()); // Sun Nov 06 01:15:00 EDT 2022
System.out.println(second.toString()); // Sun Nov 06 01:15:00 EST 2022
As you can see, the Second object is holding onto Standard time but the Date is actually in Daylight time. This becomes an issue with something like this:
Long time1 = 1667711700;
Long time2 = 1667715300;
Second second1 = new Second(new Date(time1*1000)); // Sun Nov 06 01:15:00 EST 2022
Second second2 = new Second(new Date(time2*1000)); // Sun Nov 06 01:15:00 EST 2022
Despite these being two different times, an hour apart, they are viewed by jfree as the same time. I therefore cannot plot them both on a time series plot. This appears to be happening to the Minute class as well as Second class.