summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Henstridge <james@jamesh.id.au>2009-02-17 12:58:45 +0900
committerJames Henstridge <james@jamesh.id.au>2009-02-17 12:58:45 +0900
commitba8be438bb174fda02adf06d3a0691b9cdee8f11 (patch)
treeea7a662ff8f25f9f3e7fefa2ebd6e0e0008d3464
parent3466b3b72d6f06547c461d97e0aa10f05591992a (diff)
downloadpsycopg2-ba8be438bb174fda02adf06d3a0691b9cdee8f11.tar.gz
* psycopg/typecast.c (typecast_parse_time): Fix up handling of
negative timezone offsets with a non-zero minutes field. * tests/test_dates.py (DatetimeTests): Add tests for time zone parsing. The test for HH:MM:SS time zones is disabled because we don't currently support it.
-rw-r--r--ChangeLog9
-rw-r--r--psycopg/typecast.c2
-rw-r--r--tests/test_dates.py5
3 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index da412b1..b8a5723 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-02-17 James Henstridge <james@jamesh.id.au>
+
+ * psycopg/typecast.c (typecast_parse_time): Fix up handling of
+ negative timezone offsets with a non-zero minutes field.
+
+ * tests/test_dates.py (DatetimeTests): Add tests for time zone
+ parsing. The test for HH:MM:SS time zones is disabled because we
+ don't currently support it.
+
2009-02-16 Federico Di Gregorio <fog@initd.org>
* FreeBSD now has round(). Modified config.h as suggested by
diff --git a/psycopg/typecast.c b/psycopg/typecast.c
index dcd9b37..a21b30f 100644
--- a/psycopg/typecast.c
+++ b/psycopg/typecast.c
@@ -155,7 +155,7 @@ typecast_parse_time(const char* s, const char** t, Py_ssize_t* len,
}
if (t != NULL) *t = s;
- *tz = tzs * tzhh*60 + tzmm;
+ *tz = tzs * (tzhh * 60 + tzmm);
if (*us != 0) {
while (usd++ < 6) *us *= 10;
diff --git a/tests/test_dates.py b/tests/test_dates.py
index ff6f855..eda4e89 100644
--- a/tests/test_dates.py
+++ b/tests/test_dates.py
@@ -136,7 +136,10 @@ class DatetimeTests(unittest.TestCase, CommonDatetimeTestsMixin):
self.check_timezone(curs, "+01:15", 4500)
self.check_timezone(curs, "-01:15", -4500)
- def test_parse_datetime_timezone_hours_minutes_seconds(self):
+ # This test is disabled because we don't support parsing second
+ # resolution timezone offsets and Python wouldn't handle them even
+ # if we did.
+ def disabled_test_parse_datetime_timezone_hours_minutes_seconds(self):
conn = psycopg2.connect(tests.dsn)
curs = conn.cursor()
self.check_timezone(curs, "+01:15:42", 4542)