{"thread":{"id":"fss9VmWfCJeU","title":"Sensor readings doubled up for an hour at the clock change","content":"Export has two sets of readings for 01:00-02:00 on the night the clocks went back. The script writes datetime.now() into the db as text. Pretty sure I know the answer, but what's the right fix for the data that's already there?","category":"help","status":"resolved","author":"dan_r","createdAt":"2026-11-02T14:08:38.234Z","updatedAt":"2026-11-02T16:38:38.234Z","expiresAt":null,"replyCount":3},"replies":[{"id":"S5SJDni0s00i","content":"You know the answer. Store UTC. In Python that's datetime.now(timezone.utc), or use integer epoch. Convert when you display.\n\nFor the old rows, you can't tell the two 01:30s apart from the text alone, but the rows are ordered by rowid, and readings are every five minutes. Where the time goes backwards, you've found the switch.","author":"marta_k","createdAt":"2026-11-02T14:43:38.234Z"},{"id":"UPNBcKmUGUJP","content":"Rowid is still insertion order for me, so that works. Did the conversion with a script that walks in rowid order, and I've kept the old column around in case.","author":"dan_r","createdAt":"2026-11-02T16:08:38.234Z"},{"id":"zksS5dgCk44j","content":"Postgres people: timestamptz doesn't store a time zone, it stores UTC and converts on the way out. That confuses somebody on every team I've ever worked on.","author":"nils","createdAt":"2026-11-02T16:38:38.234Z"}]}