I have a couple unusual TimeZone objects that I am having trouble using with the library. I've traced my issue to SolarEventCalculator.adjustForDST - when inDaylightTime it assumes a constant offset of 1hr.
My first unusual TimeZone uses daylight savings but applies an offset other than an hour - its getDSTSavings() method returns an arbitrary value.
My second unusual TimeZone uses daylight savings but applies a dynamic offset that depends on the date - its always inDaylightTime, its getOffset(long date) is different depending on date, and its getDSTSavings() value is completely ignored. I'm sure that breaks a whole slew of rules (but thats the way this TimeZone object works).
For the first I think the fix is to add the value of getDSTSavings (converted from ms to hours) instead of adding BigDecimal.ONE.
For the second I think the fix is to replace getDSTSavings (or 1hr) with the value of getOffset(date) - getRawOffset (converted from ms to hours), which shouldn't change anything for normal timezones (the difference will equal getDSTSavings), but should allow the unusual TimeZone to work right.
I'll also submit a pull request. Maybe the second type of timezone isn't worth accommodating, but I am thinking adjustForDST should at least use getDSTSavings instead of BigDecimal.ONE.
I have a couple unusual TimeZone objects that I am having trouble using with the library. I've traced my issue to
SolarEventCalculator.adjustForDST
- wheninDaylightTime
it assumes a constant offset of 1hr.getDSTSavings()
method returns an arbitrary value.inDaylightTime
, itsgetOffset(long date)
is different depending ondate
, and itsgetDSTSavings()
value is completely ignored. I'm sure that breaks a whole slew of rules (but thats the way this TimeZone object works).For the first I think the fix is to add the value of
getDSTSavings
(converted from ms to hours) instead of addingBigDecimal.ONE
.For the second I think the fix is to replace
getDSTSavings
(or 1hr) with the value ofgetOffset(date) - getRawOffset
(converted from ms to hours), which shouldn't change anything for normal timezones (the difference will equalgetDSTSavings
), but should allow the unusual TimeZone to work right.I'll also submit a pull request. Maybe the second type of timezone isn't worth accommodating, but I am thinking
adjustForDST
should at least usegetDSTSavings
instead ofBigDecimal.ONE
.