Skip to content

Commit 31154af

Browse files
author
James William Pye
committed
Use UTC for timestamptz and properly set the tzinfo on timetz.
1 parent 35fcc49 commit 31154af

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

postgresql/protocol/typio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def timetz_unpack(tstz):
205205
tuple.
206206
"""
207207
t = time_unpack(tstz[0])
208-
t.tzinfo = FixedOffset(tstz[1])
208+
return t.replace(tzinfo = FixedOffset(tstz[1]))
209209

210210
datetimemap = {
211211
pg_types.INTERVALOID : (interval_pack, interval_unpack),
@@ -575,7 +575,7 @@ def _pack_timestamptz(self, dt):
575575
def _unpack_timestamptz(self, data):
576576
dt = self._ts_unpack(data)
577577
dt = dt.replace(tzinfo = UTC)
578-
return dt.astimezone(self.tzinfo)
578+
return dt
579579

580580
def set_timezone(self, offset, tzname):
581581
self.tzinfo = FixedOffset(offset, tzname = tzname)

0 commit comments

Comments
 (0)