Re: Stumbled upon a time bug...

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: Stumbled upon a time bug...
Дата
Msg-id 3CBB9387.ECE6030E@fourpalms.org
обсуждение исходный текст
Ответ на Stumbled upon a time bug...  ("Rod Taylor" <rbt@zort.ca>)
Список 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: Re: RFC: Generating useful names for foreign keys and checks
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [SQL] 16 parameter limit