[Haskell-cafe] Adding to / subtracting from a LocalTime?

Yitzchak Gale gale at sefer.org
Sun Aug 19 16:32:04 CEST 2012

Adde Nilsson wrote:
>>> Ok, do you know of any way to add/subtract without converting to UTC and
>>> back?

Brandon Allbery wrote:
>> I'm not sure I'd do that in any environment, since usually libraries don't
>> deal with the result crossing a daylight/summer time change (and those that
>> do, surprise surprise, normalize to UTC).

> Didn't know, thanks.
> Back in Haskell land my conclusion is that if you're planning on doing pure
> date calculations you have to pass a TimeZone as well.

For that to work near clock changes, you need to
have the latest summer time/DST policies coded
in your app so that you can pass the correct TimeZone.
You also need hand-coded logic to handle clock
times that occur twice, and clock times that never occur at
all, due to changes of clock.


An alternative is to use the timezone-series package.
Your timezone series knows about the latest
clock change policies if you create it from an
up-to-date Olson timezone file using the
timezone-olson package.




More information about the Haskell-Cafe mailing list