[Python-Dev] os.getmtime now returns a float?
"Martin v. Löwis"
martin at v.loewis.de
Tue Jun 20 00:42:40 CEST 2006
Gregory P. Smith wrote:
> os.path.getmtime returns a float on linux (2.5a2/b1 HEAD); in 2.4 it
> returned an int. this change makes sense, its what time.time returns.
> should there be a note in Misc/NEWS or whatsnew mentioning this minor
> change (or did i miss it)? It breaks code that unintentionally
> depended on it returning an int.
There is an entry in Misc/NEWS:
- stat_float_times is now True.
The change was originally announced in
During testing, it was found that some applications will break if time
stamps are floats. For compatibility, when using the tuple interface of
the stat_result time stamps will be represented as integers. When using
named fields (a feature first introduced in Python 2.2), time stamps are
still represented as integers, unless os.stat_float_times() is invoked
to enable float return values:
In Python 2.4, the default will change to always returning floats.
More information about the Python-Dev