Re: Bug in Time/Date routines

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: Bug in Time/Date routines
Дата
Msg-id 3A01AFEE.9E8B7115@alumni.caltech.edu
обсуждение исходный текст
Ответ на Bug in Time/Date routines  (Moritz Gmelin <moritz.gmelin@gmx.de>)
Список pgsql-bugs
> > If you take any other month than October, it is working fine. So
> > 09-01-2000 + 1 month => 10-01-2000.
> regression=# select ('10-01-2000'::timestamp + ('1 month')::timespan);
>         ?column?
> ------------------------
>  2000-10-31 23:00:00-05
> (1 row)
> Thomas, isn't the addition of '1 month' done symbolically in a struct tm?
> I suspect you may have forgotten to set tm_isdst = -1 before invoking
> mktime(), causing it to interpret the time of day on the target date
> as the same DST or not-DST case that applied on the initial date.
> Seems to me that both times should be taken as "local time", so you
> should force mktime() to recompute whether DST is in effect or not.

That particular operation needs mktime() called twice in some cases :(

Once for the input timestamp and once for the intermediate result. I'm
testing a fix now which gives the right result for this particular case.

                   - Tom

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: strange array insertion
Следующее
От: Lennert Buytenhek
Дата:
Сообщение: waiting for lock?