diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-05-07 18:28:31 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-05-15 14:27:24 +0100 |
commit | c46a1dad630b108892dcc282c882a27c1d5deafa (patch) | |
tree | 5abdcd6d8fbcc161560a0d50fac9a52e80ade710 /psycopg/adapter_datetime.c | |
parent | afea19651cd5bcdcfb58c858a41cb2512b2879da (diff) | |
download | psycopg2-c46a1dad630b108892dcc282c882a27c1d5deafa.tar.gz |
Fixed TimeFromTicks for second values > 59.5.
Diffstat (limited to 'psycopg/adapter_datetime.c')
-rw-r--r-- | psycopg/adapter_datetime.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c index f684163..8d5aa3d 100644 --- a/psycopg/adapter_datetime.c +++ b/psycopg/adapter_datetime.c @@ -389,7 +389,7 @@ psyco_DateFromTicks(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "d", &ticks)) return NULL; - t = (time_t)round(ticks); + t = (time_t)floor(ticks); if (localtime_r(&t, &tm)) { args = Py_BuildValue("iii", tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday); if (args) { @@ -411,7 +411,7 @@ psyco_TimeFromTicks(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args,"d", &ticks)) return NULL; - t = (time_t)round(ticks); + t = (time_t)floor(ticks); ticks -= (double)t; if (localtime_r(&t, &tm)) { args = Py_BuildValue("iid", tm.tm_hour, tm.tm_min, |