psycopg2 rounds unix time [solved]

Luis P. Mendes luis_lupe2XXX at netvisaoXXX.pt
Mon Feb 6 08:06:27 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


|> example:
|> unix time inserted at first row: 1138839839.64456
|> unix time as retrieved in psql: 1.13884e+09
|> unix time retrieved by psycopg2: 1138840000.0

| Note: When timestamp values are stored as double precision
| floating-point numbers (currently the default), the effective limit of
| precision may be less than 6. timestamp values are stored as seconds
| before or after midnight 2000-01-01. Microsecond precision is achieved
| for dates within a few years of 2000-01-01, but the precision degrades
| for dates further away. When timestamp values are stored as eight-byte
| integers (a compile-time option), microsecond precision is available
| over the full range of values. However eight-byte integer timestamps
| have a more limited range of dates than shown above: from 4713 BC up to
| 294276 AD. The same compile-time option also determines whether time and
| interval values are stored as floating-point or eight-byte integers. In
| the floating-point case, large interval values degrade in precision as
| the size of the interval increases.
| """
|
| Otherwise, what data type *are* you using to store the Unix time?

Thank you for your answer.

In python, I use float data type to deal with time values (from
time.time()), for example.

In Postgresql, the unix time field was set up as real.  I've changed it
to double precision and it runs fine, now.


Luis P. Mendes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD50nTHn4UHCY8rB8RAkUUAJ9Pby8S5do7c7qMYjC6t222eDyG8wCfTJOR
aGMlkq86dN1juXUjBMgRuGQ=
=nnGl
-----END PGP SIGNATURE-----



More information about the Python-list mailing list