Blame POSIX
Posted Mar 11, 2007 10:53 UTC (Sun) by
kleptog (subscriber, #1183)
In reply to:
not using zoneinfo by ldo
Parent article:
Switching your Linux systems to the new DST (Linux-Watch)
PostgreSQL does use the zoneinfo database, they just modified the code to make it more usable. Until recently the zoneinfo database was 100% compatable so you could symlink them with the version supplied by the OS. (Upstream added support for leap-seconds, which changed the disk format). The reasons why PostgreSQL uses its own are:
1. Access to multiple timezones. The only way to do that in POSIX is to set the TZ environment variable. Which means that if you run a query using two timezones, the C library would reload the timezone file twice for every row in your query. Say goodbye to performance.
2. Cross-platform support. Not every OS uses zoneinfo (*cough*Windows*cough*), so if you want consistant query results across 11 OSes, you need to manage it yourself.
3. Stability. Not every C library was memory-leak free when faced with hundreds of timezone changes per second.
If the writers of POSIX had simply from the beginning decided to allow the timezone as an argument to the time functions, this would be much less of an issue. Recently I looked at glib, figuring it might handle this. But no, it also assumes your whole program only wants to work in one timezone. Ugh.
I made a plugin to Gaim to display the times of other users. I also copied the zoneinfo code into that, because it's a big no-no for plugins to start playing with environment variables, especialy those with such a wide effect as TZ... Yes, Glibc can do it, but there's always the *but it doesn't work on Windows* crew...
(
Log in to post comments)