Re: Algorithm to exploit 32 bit time functions to do time zone calculations

Thorsten Glaser <[email protected]> Tue, 16 Sep 2008 21:07:49 +0000 (UTC)
Newsgroups gmane.os.miros.general,gmane.comp.lib.libtai
Message-ID <[email protected]>
Michael G Schwern dixit:

>You: "Your shit is boring."

More like "has been done already". Sorry.

>If I understand correctly, that's an entire operating system.

Yes, but the gist is, that there is code which uses a certain 64-bit type,
called time_t, but you could of course just use int64_t instead, which does
the job quite fine. (Not even a binary change in the time zone data format.=
)

>Also you might want to have a look at the tests in y2038.

This is actually a good idea. Compiling (I think it was) CVS with the
changes was a good test too, as the configure script =E2=80=9Cchecks whethe=
r
mktime() works=E2=80=9D. To get that right (over all of the 64 bit) was har=
d.
You have to think about very many border cases=E2=80=A6 in the end, I just
ensured the round-trip via tai64_t was right, not neccessarily the
tai64_t representation itself.

bye,
//mirabilos
--=20
Sometimes they [people] care too much: pretty printers [and syntax highligh=
-
ting, d.A.] mechanically produce pretty output that accentuates irrelevant
detail in the program, which is as sensible as putting all the prepositions
in English text in bold font.=09-- Rob Pike in "Notes on Programming in C"