summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Di Gregorio <fog@initd.org>2005-07-21 08:36:55 +0000
committerFederico Di Gregorio <fog@initd.org>2005-07-21 08:36:55 +0000
commitb17acddcf59cd150c32013485039fb9339edeafb (patch)
treea22a827d3a331bd447a122ed166acf67877de9b9
parent86346579ba2969c9003b8f635fc08ba63c3389e5 (diff)
downloadpsycopg2-b17acddcf59cd150c32013485039fb9339edeafb.tar.gz
1900 years shift fix.
-rw-r--r--ChangeLog5
-rw-r--r--psycopg/adapter_datetime.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a4a948..646dda1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-21 Federico Di Gregorio <fog@debian.org>
+
+ * 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 <fog@debian.org>
* Release 2.0 beta 4.
diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c
index 656e14f..1afcb0c 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);