summaryrefslogtreecommitdiff
path: root/lib/tz.py
diff options
context:
space:
mode:
authorMenno Smits <menno@freshfoo.com>2012-01-17 15:51:32 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2012-01-30 13:27:01 +0000
commit1469a56512a9776eb87629be7894b3bf2be89183 (patch)
treee3810135c925a1b51baf0218d5b9a8531d44b9eb /lib/tz.py
parent35ff2def347aba23e89f464a7610275f1e2e4c57 (diff)
downloadpsycopg2-1469a56512a9776eb87629be7894b3bf2be89183.tar.gz
Fixed repr for FixedOffsetTimezone for offsets west of UTC (negative)
The offset displayed was always positive and somewhat confusing. The offset displayed now is the offset that the instance was created with. Also added some tests for initialisation.
Diffstat (limited to 'lib/tz.py')
-rw-r--r--lib/tz.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/tz.py b/lib/tz.py
index f7d9e45..e353f9b 100644
--- a/lib/tz.py
+++ b/lib/tz.py
@@ -50,8 +50,9 @@ class FixedOffsetTimezone(datetime.tzinfo):
self._name = name
def __repr__(self):
+ offset_mins = self._offset.seconds // 60 + self._offset.days * 24 * 60
return "psycopg2.tz.FixedOffsetTimezone(offset=%r, name=%r)" \
- % (self._offset.seconds // 60, self._name)
+ % (offset_mins, self._name)
def utcoffset(self, dt):
return self._offset