Re: Message to `tz' mailing list
Date: Fri, 17 Feb 2006 15:14:09 +0530 From: "N. Raghavendra" <raghu@mri.ernet.in> Message-ID: <867j7ugw0m.fsf@riemann.mri.ernet.in> | Perhaps I did not express my question clearly. I am trying to | understand how, given | | 1. an integer TIME (viewed as a number of seconds since the Epoch); | and | | 2. a TZFILE, | | one computes the wall clock time corresponding to TIME, in the time | zone defined by TZFILE. The wall clock time should be returned as a | broken-down time value, i.e., as a list of the form | | (SEC, MIN, HOUR, MDAY, MON, YEAR, WDAY, IS_DST, TZ_ABBREV, GMT_OFF) That's exactly what localtime() does isn't it? All the code is available (and free to use) - just use it (either the learn from, or simply to compile into your application). The raw tzfile isn't used of course, it is converted (using zic) into a binary format - but if you needed to you could combine the roles of zic and localtime into one function. kre
At 2006-02-17T17:49:51+07:00, Robert Elz wrote:
That's exactly what localtime() does isn't it? All the code is available (and free to use) - just use it (either the learn from,
Yes, I know that that is what localtime(3) does, and I have been reading `localtime.c'. However, as I said in my OP, my knowledge of C is rather meagre, so I wanted to check my understanding by asking on the list.
or simply to compile into your application).
Since I am working in Common Lisp, I want to rewrite the functionality of localtime(3) directly in that language.
The raw tzfile isn't used of course, it is converted (using zic) into a binary format - but if you needed to you could combine the roles of zic and localtime into one function.
By `tzfile', I meant precisely the binary files produced by `zic', and documented in tzfile(5). I am now able to unpack the binary files correctly into Lisp objects. Next, I should interpret the unpacked data properly. Thank you very much for your response. Raghavendra. -- N. Raghavendra <raghu@mri.ernet.in> | See message headers for contact Harish-Chandra Research Institute | and OpenPGP details.
Date: Fri, 17 Feb 2006 17:59:00 +0530 From: "N. Raghavendra" <raghu@mri.ernet.in> Message-ID: <86hd6ynp83.fsf@riemann.mri.ernet.in> | By `tzfile', I meant precisely the binary files produced by `zic', and | documented in tzfile(5). I am now able to unpack the binary files | correctly into Lisp objects. Next, I should interpret the unpacked | data properly. OK, that wasn't clear. If you're working with the binary file, then ado's reply is the one you should take notice of. All you need to do is find the transitions in that file that are immediately before, and after, the time you start with - the one before then tells you the timezone offset, name, ... The one after is needed just so you are sure you have found the correct "before". The only complication is if you're trying to handle times into the far future - when all anyone can do is guess at what the rules will be. If you want to accept the timezone's project's guesses (which really just assume that the current rules will not change - which means that they are almost certainly wrong) then you need to extrapolate from the data at the end of the file. That is where knowing what the rules actually say is useful (and where you might hare about the standard vs wall-clock vs UTC indications). Otherwise, those things, as ado's reply said, are simply irrelevant to you. Jesper's reply was assuming that you (or someone) was reading the source (tzdata) files. kre
At 2006-02-19T19:24:45+07:00, Robert Elz wrote:
The only complication is if you're trying to handle times into the far future - when all anyone can do is guess at what the rules will be. If you want to accept the timezone's project's guesses (which really just assume that the current rules will not change - which means that they are almost certainly wrong) then you need to extrapolate from the data at the end of the file. That is where knowing what the rules actually say is useful (and where you might hare about the standard vs wall-clock vs UTC indications).
Thank you very much for the advice. I will keep that in mind. Raghavendra. -- N. Raghavendra <raghu@mri.ernet.in> | See message headers for contact Harish-Chandra Research Institute | and OpenPGP details.
participants (2)
-
N. Raghavendra -
Robert Elz