I keep getting burned by how web2py handles datetimes; specifically, my project requires millisecond precision of timestamps. The two databases I care about support it, pgsql has microsecond resolution and sqlite is agnostic (pysqlite3 specifically supports microseconds). MySQL and Oracle, however, only have 1 second resolution.
Massimo, you've said before that it will not change from 1 second resolution because of missing support; but the fact that microseconds are currently silently deleted in the web2py is burning me again and again, even when not related to the dal -- most recently in json export. I suggest one of the following changes: 1. refactor datetime<->text and text<->datetime conversions; these are currently repeated in serializers.py once (json serialization), tools.py once (csv output), dal.py (base represent(), oracle/informix/db2 represent_exceptions(), Rows as_dict(), Rows export_to_csv_file none_exception; parsing repeated in parse() and GoogleSQL code); and make them hookable so that an app can request higher precision handling if needed; also mark in adapter that this resolution is NOT AVAILABLE on Oracle, MySQL, etc. and trigger error if time has second fractions. 2. Add a warning/error in all the places where second fractions are silently dropped I would much prefer option (1), but (2) is the lesser of two evils. If I submit a patch that does (1), will you accept it? if not, will you accept a patch that does (2)? For users of MySQL, the following might be helpful <http://stackoverflow.com/questions/2572209/why-doesnt-mysql-support-millisecond-microsecond-precision> (PHP, but still might be useful). Thanks in advance.