> Instead float numbers would not have enough precision to represent
> datetime.

Is this statement correct?

Python docs describe python doubles as having 53 bits of precision, or
about 16 base-10 digits. If I'm thinking about this right, that leaves
enough digits to have a resolution of 0.00001 seconds when storing
current times in epoch-seconds. (eg 1243695729 is approximately now to
the nearest second, which uses 10 digits). This suggests that if one
is working with time values that don't go far into future years, and
one doesn't need to be more precise than 0.00001 seconds, then
python's double would be an adequate option for storing datetime
information. Please correct me if I'm wrong.

Furthermore, I just ran a test using a web2py app, converting a double
to a datetime and storing it in a SQLite database. Reading back the
information, this is what it has in the database:
time.struct_time(tm_year=2009, tm_mon=5, tm_mday=19, tm_hour=14,
tm_min=0, tm_sec=8, tm_wday=1, tm_yday=139, tm_isdst=0)
which has precision of 1 second. This struct representation might be
easier to parse for some applications, but the storage space
requirements (at least of this text encoding method) and precision are
inferior to those of a double. Maybe there are better storage formats
and the precision is a adjustable?

Dan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to