Re: sslinfo extension - add notbefore and notafter timestamps

Поиск
Список
Период
Сортировка
От Jacob Champion
Тема Re: sslinfo extension - add notbefore and notafter timestamps
Дата
Msg-id CAOYmi+nMSneR0XYr7Q_fvXtW5fbSEZ_Wt+1SxBHESZA-iMAxPQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: sslinfo extension - add notbefore and notafter timestamps  (Daniel Gustafsson <daniel@yesql.se>)
Ответы Re: sslinfo extension - add notbefore and notafter timestamps  (Daniel Gustafsson <daniel@yesql.se>)
Список pgsql-hackers
On Wed, Mar 20, 2024 at 7:03 AM Daniel Gustafsson <daniel@yesql.se> wrote:
> The issue here is that postgres use a different epoch from the unix epoch, so
> any dates calcuated based on the unix epoch need to be adjusted.

Ah, thank you! I had just reproduced Cary's problem and was really confused...

> I've hacked
> this up in the attached v11 using overflow-safe integer mul/add as proposed by
> Jacob upthread (we really shouldn't risk overflowing an int64 here but there is
> no harm in using belts and suspenders here as a defensive measure).
>
> The attached v11 is what I propose we go ahead with unless there further
> comments on this.

One last question:

> +   result -= ((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * USECS_PER_DAY);
> +   return TimestampTzGetDatum(result);

Is that final bare subtraction able to wrap around for dates far in the past?

--Jacob



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

Предыдущее
От: Daniel Gustafsson
Дата:
Сообщение: Re: Refactor SASL exchange in preparation for OAuth Bearer
Следующее
От: Nathan Bossart
Дата:
Сообщение: Re: add AVX2 support to simd.h