tags:

views:

314

answers:

5

Some time ago I put together a time based library that could be used for working out relative times within a year for someone. I noted at the time, that it did the one hour shift in both directions for daylight savings. It just occurred to me that Congress changed the daylight savings time rules. I don't recall seeing any information about updates to resolve the change in algorithms. Does anyone have any information on this topic?

+1  A: 

For Visual Studio 2005 and earlier, Microsoft has released updated versions of the C runtime libraries. More information can be found here.

ChrisN
+1  A: 

What platform are you working on?

Since Congress doesn't set the rules for the whole world :) there has been a mechanism for flexibly specifying the rules on Unix/Linux for a long time

See, for example, http://www.manpagez.com/man/8/zic/ for the format of the files. Your particular system may need an updated definition for the new rules (if the distribution hasn't dealt with it already)

For Windows, MS build in some rules and release updates when things change.

For MacOs, I have no idea, but I imagine it inherits the Unix way of doing things.

But in all these cases, no change to the C library should be needed

Paul
A: 

On a more general note, the C runtime does use internal data files to map from the internal time representation to the user's locale. These mappings are updated regularly by the respective vendors to match current legislation.

David Schmitt
A: 

Since internal clocks should be set to UTC, daylight saving time is just a matter of changing timezone. For example, on my locale, on October 26 my Mac switched from CEST ( central european summer time ) to 'normal' CET ( central european time ). My clock's display changed, but not the computer's time.

http://www.timeanddate.com/library/abbreviations/timezones/eu/cest.html

Indeed this means you absolutely have to keep your datetime variables either in UTC or in a native format that takes the timezone into account. That's why just recording datetime as a "YYYYMMDDHHMMSS" string, is a bug waiting to happen.

vincent
+3  A: 

Most Unix-like systems use the Olson tz database for their timezone information:

http://www.twinsun.com/tz/tz-link.htm

The changes to the US timezone rules were implemented in version 2005l of the tz database.

Phil Ross