* 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.
This commit is contained in:
James Henstridge 2009-02-17 12:58:45 +09:00
parent 3466b3b72d
commit ba8be438bb
3 changed files with 14 additions and 2 deletions

View File

@ -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

View File

@ -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;

View File

@ -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)