Re: now() vs 'epoch'::timestamp

Поиск
Список
Период
Сортировка
Искать
От
David G. Johnston
Тема
Re: now() vs 'epoch'::timestamp
Дата
Msg-id
CAKFQuwYS7Z5RscWxsNYe3-ON=CouV4Nbw_0vzprv0m+TxDFrEQ@mail.gmail.com
Ответ на
Список
Дерево обсуждения
now() vs 'epoch'::timestamp James Cloos <cloos@jhcloos.com>
Re: now() vs 'epoch'::timestamp Stephen Frost <sfrost@snowman.net>
Re: now() vs 'epoch'::timestamp James Cloos <cloos@jhcloos.com>
Re: now() vs 'epoch'::timestamp Tom Lane <tgl@sss.pgh.pa.us>
Re: now() vs 'epoch'::timestamp Steve Crawford <scrawford@pinpointresearch.com>
Re: now() vs 'epoch'::timestamp James Cloos <cloos@jhcloos.com>
Re: now() vs 'epoch'::timestamp "David G. Johnston" <david.g.johnston@gmail.com>
Re: now() vs 'epoch'::timestamp Steve Crawford <scrawford@pinpointresearch.com>
Re: now() vs 'epoch'::timestamp Adrian Klaver <adrian.klaver@aklaver.com>
Re: now() vs 'epoch'::timestamp James Cloos <cloos@jhcloos.com>
Re: now() vs 'epoch'::timestamp James Cloos <cloos@jhcloos.com>
On Thu, Apr 2, 2015 at 10:27 AM, James Cloos <cloos@jhcloos.com> wrote:
>>>>> "SC" == Steve Crawford <scrawford@pinpointresearch.com> writes:

SC> Very convoluted calculation as others have noted. As to why it is
SC> "off", you are casting one part of the statement to an integer thus
SC> truncating the microseconds but are not doing the same on the other
SC> side of the calculation.

It wasn't the microsecond difference I asked about, it was the 6 hour difference.

The original, ancient code I used needed to return integer seconds.  And
it always gave answers consistant with date +%s.

What I haven't determined is why converting back is off by 21600 seconds.


​What timezone is your server set to - and/or the client requesting the calculation?

​I haven't looked to see if that is a plausible explanation but if you are +/- 6hrs from UTC...

David J.

В списке pgsql-general по дате отправления
От: James Cloos
Дата:
От: Steve Crawford
Дата:
FAQ