various time related problems
Hello, I hope that those on this list can help me with a problem I've been trying to solve for the last week or so. I found a link to this list in a newsgroup post. I don't know if anyone here deals with programming or if this is simply to do with date/time standards or what. If I am in the wrong news group just let me know. The Problem: In a project I'm taking part in we're building a custom date/time class for inclusion in a library. Everything works except a few things we'd like to implement. The date class will be used mainly for conversions and such and to timestamp certificates for encryption purposes. We're using the standard C/C++ library functions for most everything. What I'd like to be able to do is give this class a date as a string (similar to an email date) and have it convert to a tm struct. The only problem is that I need to take into account what timezone the date is in. For instance if I receive an email from someone in Japan (I am in Calgary, Canada). The date/time would look like this in the headers. Thu, 05 Jul 2001 HH:MM:SS JST. Is there anyway I can get a list of 3 letter abreviations so to get the JST and convert to an UTC offset? This way I can convert between times and such. The regular c/c++ functions do not support this coming from a string. Only outputting the timezone info from a tm struct to a string. Any help / ideas with this would be appreciated. Sincerely, Nathanael Noblet ===================== Primality Inc. 208 - 908 17th Ave SW Calgary, AB (403) 262-5616 ext226
Date: Mon, 9 Jul 2001 13:37:12 -0600 From: Nathanael Noblet <nathanael@primality.com> Message-ID: <0107091337120C.08498@perseus> | Is there anyway I can get a list of 3 | letter abreviations so to get the JST and convert to an UTC offset? This is a very common question and desire. The reason you are having to hunt to try to find the information is that there simply is no way to do this - those 3 letter (well, not always, they can be other lengths as well) abbreviations aren't standardised anywhere, and more importantly aren't unique (is JST Japanese time, or Jordanian time ??) The correct thing (though certainly not easy) to do is to get anyone using a mailer that is sending such a timezone in the Date line of an e-mail header to get fixed - it us unquestionably broken, JST isn't a legal string to use as a timezone in a Date header - while there are a few that are (the US standard ones, plus GMT basically) everyone should really be using numeric timezone indicators. Those are easy to parse... kre
From: Nathanael Noblet <nathanael@primality.com> Date: Mon, 9 Jul 2001 13:37:12 -0600
Is there anyway I can get a list of 3 letter abreviations so to get the JST and convert to an UTC offset?
This question comes up often enough that I'll add something like the following text to the tz-link.htm file in my next proposed patch: Alphabetic time zone abbreviations should not be used as unique identifiers for UTC offsets as they are ambiguous in practice. For example, "EST" denotes 5 hours behind UTC in English-speaking North America, but it also denotes 10 or 11 hours ahead of UTC in Australia; and French-speaking North Americans prefer "HNE" to "EST". For compatibility with POSIX the tz database contains English abbreviations for all time stamps but in many cases these are merely inventions of the database maintainers.
participants (3)
-
Nathanael Noblet -
Paul Eggert -
Robert Elz