[Python-Dev] redux: fractional seconds in strptime

Mark Russell marktrussell at btopenworld.com
Fri Jan 14 13:24:24 CET 2005


On Fri, 2005-01-14 at 09:36, Skip Montanaro wrote:
> Actually, time.strptime() returns a struct_time object.  Would it be
> possible to extend %S to parse floats then add a microseconds (or whatever)
> field to struct_time objects that is available by attribute only?

+1 for adding a microseconds field to struct_time, but I'd also like to
see an integer-only way of parsing fractional seconds in time.strptime. 
Using floating point makes it harder to support exact comparison of
timestamps (an issue I recently ran into when writing unit tests for
code storing timestamps in a database).

My vote is for %<digit>N producing a microseconds field.

Mark Russell



More information about the Python-Dev mailing list