> 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
Correction: I should have explained that I used the time.gmtime() function to convert the double to a time struct. Since writing that message, I've discovered a new module for working with time, and using these two functions together preserves the precision in the double: mytimefloat = 1243695729.123456 mytimeint = int(timefloat) mytimefrac = timefloat - timeint mydatetime = datetime.datetime.utcfromtimestamp(mytimeint) + datetime.timedelta(microseconds = timefrac * 1000000) and the representation in the SQLite database is: datetime.datetime(2009, 5, 30, 15, 2, 9, 123456) 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 -~----------~----~----~----~------~----~------~--~---

