Hi! There seems to be a problem with the clock on the server. I am seeing updated timestamps in the future after a sync: peeringmanager=# select id,name,status,created,updated from peeringdb_organization where updated>CURRENT_TIMESTAMP order by updated desc; id | name | status | created | updated -------+--------------------------------------+--------+------------------------+------------------------ 25094 | MYDCHUB | ok | 2020-02-05 04:33:05+01 | 2020-02-05 04:33:05+01 25093 | Westpac Bank | ok | 2020-02-05 03:34:14+01 | 2020-02-05 03:34:14+01 25092 | N DOS SANTOS & SANTOS LTDA - ME - ME | ok | 2020-02-05 02:38:08+01 | 2020-02-05 02:40:34+01 25091 | hybris GmbH | ok | 2020-02-04 23:36:50+01 | 2020-02-05 01:36:19+01 16124 | Data Space Sp. z o.o. | ok | 2017-01-29 16:58:31+01 | 2020-02-05 01:28:41+01 (5 rows) peeringmanager=# select CURRENT_TIMESTAMP; current_timestamp ------------------------------- 2020-02-04 23:35:06.646783+01 (1 row) Cheers, Sander
Hi,
There seems to be a problem with the clock on the server. I am seeing updated timestamps in the future after a sync:
Never mind, it turns out that the django_peeringdb module is doing weird things with time zones. It stores them with a weird offset in the database. Anyway, not a server problem Sander
I submitted an issue about this on github, but it was more to do with an inconsistency between using localtime in the local database and UTC coming from PDB. This is not the first time I have encountered timezone related bugs with the Python PDB modules. Which database are you using? Postgres? ________________________________ From: Pdb-tech <pdb-tech-bounces@lists.peeringdb.com> on behalf of Sander Steffann <sander@steffann.nl> Sent: Tuesday, February 4, 2020 3:20:44 PM To: pdb-tech@lists.peeringdb.com Subject: Re: [PDB Tech] Clock skew? Hi,
There seems to be a problem with the clock on the server. I am seeing updated timestamps in the future after a sync:
Never mind, it turns out that the django_peeringdb module is doing weird things with time zones. It stores them with a weird offset in the database. Anyway, not a server problem Sander
Hi,
I submitted an issue about this on github, but it was more to do with an inconsistency between using localtime in the local database and UTC coming from PDB. This is not the first time I have encountered timezone related bugs with the Python PDB modules. Which database are you using? Postgres?
Yep. I already traced it and created an issue+PR: https://github.com/peeringdb/django-peeringdb/issues/38 https://github.com/peeringdb/django-peeringdb/pull/39 This strange situation is cause by Django using TIME_ZONE = 'America/Chicago' by default and the django-peeringdb code running with time zone support off. With PostgreSQL Django always stores a datetime in UTC, and uses the TIME_ZONE setting to convert it. By explicitly setting TIME_ZONE='UTC' in the default Django settings everything makes sense again :) I strongly feel that TIME_ZONE='UTC' should be the Django default, but apparently it isn't :/ Cheers, Sander
On Wed, Feb 05, 2020 at 12:50:13AM +0100, Sander Steffann wrote:
Hi,
I submitted an issue about this on github, but it was more to do with an inconsistency between using localtime in the local database and UTC coming from PDB. This is not the first time I have encountered timezone related bugs with the Python PDB modules. Which database are you using? Postgres?
Yep. I already traced it and created an issue+PR:
https://github.com/peeringdb/django-peeringdb/issues/38 https://github.com/peeringdb/django-peeringdb/pull/39
This strange situation is cause by Django using TIME_ZONE = 'America/Chicago' by default and the django-peeringdb code running with time zone support off. With PostgreSQL Django always stores a datetime in UTC, and uses the TIME_ZONE setting to convert it. By explicitly setting TIME_ZONE='UTC' in the default Django settings everything makes sense again :)
I strongly feel that TIME_ZONE='UTC' should be the Django default, but apparently it isn't :/
I agree, we will review. I believe there was a reason that it wasn't set by default, but I can't remember what it was. Cheers
participants (3)
-
Matt Griswold -
Milton Ngan -
Sander Steffann