1900 years shift fix.

This commit is contained in:
Federico Di Gregorio 2005-07-21 08:36:55 +00:00
parent 86346579ba
commit b17acddcf5
2 changed files with 7 additions and 2 deletions

View File

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

View File

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