I don't know any server that acts as a source for world time, including all updates. Most of the standards for weights and measures are kept in France. I believe the French keep the official time for the world, as well. Would they keep the official time zones updated? Probably.
Google around on official time zones and such, and see what you can find.
If they change their offset amount, then they would need to change their official tz abbreviation - so your program would have no match for that string. I'm thinking that would be your signal to look it up, and get the new data.
Note: On the tz struct, I would add another (larger) char field so you have a better indication of what the cryptic abbreviations refer to.
Last edited by Adak; 10-13-2013 at 03:43 PM.
So the search for the new TZ would fail - no abbreviation would match with it. Then you have to d/l the new set of timezone data, from <somewhere, they keep the world standards for timezones, perhaps in France>. Google on that one, because I don't know a source of completely up to date and accurate timezone data (a reference standard).
There should be one, however.
FYI: Are there NOT differences on which day of the Year the daylight vs standard time changes?
Tim S.
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson
I don't see how your compiler would know about recent changes in the world's timezones. I don't believe it knows about DST changes, except through the actual clock changes on the system - which means it wouldn't work unless the timezone was set in the global environment, etc.
I wonder how international companies deal with this?
DST changes are political. Some countries , like in Irsrael, DST may actually be legally mandated after it has already started... Lunar calendars like Hijri are so unrelated to the Gregorian calendar that Saudi Arabia has another, civil, version of the Hijri calendar. I was told the country bailed on DST because it would cause too many issues. True or not - do not know.
Adak said:
I was not clear. My bad. tzset() declares what TZ you want to operate in. %Z in strptime is not required by POSIX to work as you would think unless:Afterward, he doesn't need to reset tzset() with his own local time zone, because it was never changed in his environment.
That would be by far the easiest way to do this.
putenv("TZ=my other timezone") and then tzset() is called. I ran into this in Solaris 9. In modern Linux it seems to work without tzset(). With TZ set to somethingnew.
[LINK]http://www.iana.org/time-zones[/LINK]
All of my development is on a 64-bit Linux Redhat server. After further investigation, I happen upon the above iana site. It's essentially a timezone database that can be loaded and are loaded on different technologies distributions to control timezones. In addition, the methods we have been mentioning 'setenv()' seems to be pulling from a timezone db on disk when being set. You are right in that the compiler would not know of any recent timezone changes. One would have to subscribe to a site like such for new updates and apply it to their respective system.