Fixed problem in microseconds conversion.

This commit is contained in:
Federico Di Gregorio 2005-11-20 04:54:33 +00:00
parent f4fee20b3b
commit 03c0a258a2
3 changed files with 26 additions and 2 deletions

View File

@ -1,6 +1,12 @@
2005-11-20 Federico Di Gregorio <fog@initd.org>
* psycopg/typecast.c: fixed problem with microseconds conversion by
applying slightly modified patch from Ronnie Mackay.
2005-11-19 Federico Di Gregorio <fog@initd.org> 2005-11-19 Federico Di Gregorio <fog@initd.org>
* lib/extensions.py: COMMITED -> COMMITTED. (Closes: #73) * lib/extensions.py: COMMITED -> COMMITTED. (Closes: #73)
* doc/extensions.rst: included Daniele's work after minor cosmetic changes * doc/extensions.rst: included Daniele's work after minor cosmetic changes
like using the new constants instead of numbers for transaction isolation like using the new constants instead of numbers for transaction isolation
levels. levels.

13
INSTALL
View File

@ -16,8 +16,19 @@ to build in the local directory; and:
to install system-wide. to install system-wide.
Using setuptools and EasyInstall
================================
If setuptools are installed on your system you can easily create an egg for
psycopg and install it. Download the source distribution (if you're reading
this file you probably already have) and then edit setup.cfg to your taste
and build from the source distribution top-level directory using:
easy_install .
Compiling under Windows with mingw32 Compiling under Windows with mingw32
************************************ ====================================
You can compile psycopg under Windows platform with mingw32 compiler. The You can compile psycopg under Windows platform with mingw32 compiler. The
software required is: software required is:

View File

@ -88,6 +88,7 @@ typecast_parse_time(char* s, char** t, int* len,
{ {
int acc = -1, cz = 0; int acc = -1, cz = 0;
int tzs = 1, tzhh = 0, tzmm = 0; int tzs = 1, tzhh = 0, tzmm = 0;
int usd = 0;
/* sets microseconds and timezone to 0 because they may be missing */ /* sets microseconds and timezone to 0 because they may be missing */
*us = *tz = 0; *us = *tz = 0;
@ -121,6 +122,7 @@ typecast_parse_time(char* s, char** t, int* len,
break; break;
default: default:
acc = (acc == -1 ? 0 : acc*10) + ((int)*s - (int)'0'); acc = (acc == -1 ? 0 : acc*10) + ((int)*s - (int)'0');
if (cz == 3) usd += 1;
break; break;
} }
@ -137,6 +139,11 @@ typecast_parse_time(char* s, char** t, int* len,
*tz = tzs * tzhh*60 + tzmm; *tz = tzs * tzhh*60 + tzmm;
if (*us != 0.0) {
while (usd < 6)
*us *= (*us)*10.0;
}
return cz; return cz;
} }