Portable general timestamp format, not 2038-limited

James Harris james.harris.1 at googlemail.com
Wed Jul 4 20:46:00 CEST 2007


On 1 Jul, 15:11, "Peter J. Holzer" <hjp-usen... at hjp.at> wrote:
...
> Stick to unix timestamps but store them as a double precision floating
> point number. The 53 bit mantissa gives you currently a resolution of
> about 200 ns, slowly deteriorating (you will hit ms resolution in about
> 280,000 years, if I haven't miscalculated). Any language and database
> should be able to handle double-precision FP numbers, so that's as
> portable as it gets and conversion from/to system time should be
> trivial.
>
> If you need to represent milliseconds exactly, you can just multiply the
> timestamp with 1000 (and get java timestamps).

Interesting option. I think my choice is between separate day and sub-
day 32-bit unsigned integers, text, and this 64-bit float option.

I'm not clear, though. Did you mean to store double precision numbers
where the seconds are the units (I assume this) or where the days are
the units? And what do you think of the other option?




More information about the Python-list mailing list