mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-07 12:50:32 +03:00
Fractionary seconds fix (closes: #130)
This commit is contained in:
parent
ca860424e6
commit
168d9c36af
12
ChangeLog
12
ChangeLog
|
@ -1,11 +1,17 @@
|
|||
2006-09-30 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
* psycopg/adapter_datetime.py: now TimeFromTicks and
|
||||
TimestampFromTicks both accept fractionary seconds (fixes #130).
|
||||
|
||||
2006-09-23 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
* lib/errorcodes.py: added list of all PostgreSQL error codes
|
||||
compiled by Johan Dahlin.
|
||||
compiled by Johan Dahlin.
|
||||
|
||||
* psycopg/psycopg.h: applied compatibility macros from PEP 353.
|
||||
|
||||
* Applied patch 1/3 from Piet Delport; from his email:
|
||||
|
||||
psycopg2-Py_ssize_t-input.diff adjusts variables used for parameters
|
||||
and return values. These changes only prevent overflowing on values
|
||||
greater than 32-bits, so they're not as critical as the other two
|
||||
|
@ -14,13 +20,15 @@
|
|||
either way, not being too familiar with the codebase.
|
||||
|
||||
* Applied patch 2/3 from Piet Delport; from his email:
|
||||
|
||||
psycopg2-Py_ssize_t-output.diff adjusts variables used as outputs
|
||||
from CPython API calls: without it the calls try to write 64 bits
|
||||
to 32 bit locations, trampling over adjacent values/pointers,
|
||||
and segfaulting later.
|
||||
|
||||
* Applied patch 1/3 from Piet Delport; from his email:
|
||||
psycopg2-PyObject_HEAD.diff adds missing underscores to several
|
||||
|
||||
psycopg2-PyObject_HEAD.diff adds missing underscores to several
|
||||
"PyObject_HEAD" declarations. As far as i can tell from gdb, the
|
||||
"PyObject HEAD" versions end up accidentally meaning almost exactly
|
||||
the same, but get aligned differently on AMD64, resulting in wrong
|
||||
|
|
|
@ -375,8 +375,10 @@ psyco_TimeFromTicks(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
|
||||
t = (time_t)round(ticks);
|
||||
ticks -= (double)t;
|
||||
if (localtime_r(&t, &tm)) {
|
||||
args = Py_BuildValue("iid", tm.tm_hour, tm.tm_min, (double)tm.tm_sec);
|
||||
args = Py_BuildValue("iid", tm.tm_hour, tm.tm_min,
|
||||
(double)tm.tm_sec + ticks);
|
||||
if (args) {
|
||||
res = psyco_Time(self, args);
|
||||
Py_DECREF(args);
|
||||
|
@ -397,10 +399,12 @@ psyco_TimestampFromTicks(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
|
||||
t = (time_t)round(ticks);
|
||||
ticks -= (double)t;
|
||||
if (localtime_r(&t, &tm)) {
|
||||
args = Py_BuildValue("iiiiidO",
|
||||
tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, (double)tm.tm_sec,
|
||||
tm.tm_hour, tm.tm_min,
|
||||
(double)tm.tm_sec + ticks,
|
||||
pyPsycopgTzLOCAL);
|
||||
if (args) {
|
||||
res = psyco_Timestamp(self, args);
|
||||
|
|
Loading…
Reference in New Issue
Block a user