How to get timezone daylight saving rules from Noda Time in POSIX time zone format

As answered in Getting Daylight Savings Time Start and End in NodaTime daylight saving start and end dates can be solved for given year.

How to get the actual rules for calculating start and end date preferably in POSIX time zone format?

Project is currently using Noda Time but any other .NET solution can be considered.

Jon Skeet
people
quotationmark

The POSIX format only seems to cater for a single rule - whereas in reality, the rules change over time. It's also not clear to me whether POSIX rules allow for 24:00 as a transition time, and the expectation that all transitions are specified in local time seems unfortunate. (In TZDB, some rules are expressed in terms of UTC, some in terms of wall time, and some in terms of standard time. Performing a "simple" conversion from that to "everything is local" could cause some very subtle errors.) In short - I would expect a conversion from TZDB to POSIX to be potentially lossy.

The "actual rules" aren't exposed via the Noda Time API, as they're rarely useful to clients (compared with simply getting at the computed data) - but you could look at the NodaTime.TzdbCompiler code to see how the TZDB rules are parsed, stored in memory, and serialized to disk. The serialized format doesn't have enough information to always recover the original rules - but you could create your own serialization format in a fork, of course.

For the original ("raw") source data, the IANA time zone database is your best starting point.

people

See more on this question at Stackoverflow