From b17acddcf59cd150c32013485039fb9339edeafb Mon Sep 17 00:00:00 2001 From: Federico Di Gregorio Date: Thu, 21 Jul 2005 08:36:55 +0000 Subject: [PATCH] 1900 years shift fix. --- ChangeLog | 5 +++++ psycopg/adapter_datetime.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a4a9481..646dda11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-07-21 Federico Di Gregorio + + * psycopg/adapter_datetime.c (psyco_XXXFromTicks): fixed the 1900 + years offset reported by Jeroen van Dongen (see ticket #33). + 2005-07-17 Federico Di Gregorio * Release 2.0 beta 4. diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c index 656e14f3..1afcb0ca 100644 --- a/psycopg/adapter_datetime.c +++ b/psycopg/adapter_datetime.c @@ -338,7 +338,7 @@ psyco_DateFromTicks(PyObject *self, PyObject *args) t = (time_t)round(ticks); if (gmtime_r(&t, &tm)) { - args = Py_BuildValue("iii", tm.tm_year, tm.tm_mon+1, tm.tm_mday); + args = Py_BuildValue("iii", tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday); if (args) { res = psyco_Date(self, args); Py_DECREF(args); @@ -383,7 +383,7 @@ psyco_TimestampFromTicks(PyObject *self, PyObject *args) t = (time_t)round(ticks); if (gmtime_r(&t, &tm)) { args = Py_BuildValue("iiiiid", - tm.tm_year, tm.tm_mon+1, tm.tm_mday, + tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, (double)tm.tm_sec); if (args) { res = psyco_Timestamp(self, args);