From: | Thomas Lockhart <lockhart(at)fourpalms(dot)org> |
---|---|
To: | Rod Taylor <rbt(at)zort(dot)ca> |
Cc: | Hackers List <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Stumbled upon a time bug... |
Date: | 2002-04-16 02:59:19 |
Message-ID: | 3CBB9387.ECE6030E@fourpalms.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> Is PostgreSQL broken? Or is it FreeBSD?
Both at most. FreeBSD at least ;)
The Posix definition for mktime() insists that the function return "-1"
if it has an error. Which also happens to correspond to 1 second earlier
than 1970-01-01, causing trouble for supporting *any* times before 1970.
PostgreSQL relies on a side-effect of mktime(), that the time zone
information pointed to in the tm structure *input* to mktime() gets
updated for output. I don't actually care about the function result of
time_t, and don't care what it is set to as long as the time zone info
gets filled in.
That happens on most every platform I know about, with the exception of
AIX (confirming for me its reputation as a strange relative of Unix best
left chained in the cellar).
Apparently glibc (and hence Linux) is at risk of getting this behavior
too, although I *hope* that the mods to glibc will be to return the "-1"
(if necessary) but still using the time zone database to fill in the
time zone information, even for dates before 1970.
I'm not sure I still have the info to include the glibc contact in this
thread. In any case, there is no excuse for refusing to return valid
info for a DST boundary time imho. Even if it requires an arbitrary
convention on how to jump the time forward or backward...
- Thomas
From | Date | Subject | |
---|---|---|---|
Next Message | Hiroshi Inoue | 2002-04-16 03:18:16 | Re: ANSI Compliant Inserts |
Previous Message | Bruce Momjian | 2002-04-16 02:58:51 | Re: [SQL] 16 parameter limit |