The question was raised in a PR on how to represent time. I propose (mandate) that we represent all times via 'datetime' in the database, and the datetime class in Python, using always UTC time for everything. We should use local time (in the local time zone) only in visualizations, by converting in the generation of web pages the UTC times to local, if desired; all storage will however be UTC. This for several reasons:
- Localtime is not suirable for storage; for one thing, the correspondence between UTC and localtime is not one to one.
- UTC datetimes are easier to work with than timestamps (seconds since unix epoch in 1970); for instance, when we debug and look at the database content, it is much easier to make sense of something like 2012-09-14 13:45:56.545898 than to make sense of the number of seconds from 1970 (when, for example, we check if a particular revision is in the database, or whether we really have gotten the revisions we wanted to get).
- To compute time differences, we can use the timedelta class, which works well.
Luca