Author vstinner
Recipients Arfrever, gvanrossum, larry, loewis, pitrou, r.david.murray, rosslagerwall, vstinner
Date 2012-03-04.00:19:14
SpamBayes Score 0.0123156
Marked as misclassified No
Message-id <1330820355.6.0.34275772598.issue14127@psf.upfronthosting.co.za>
In-reply-to
Content
Because the use case is to copy the access and modification time from a file to another, I would prefer to use the timespec structure: (sec: int, nsec: int). st_atime_ns and st_mtime_ns fields would be added to os.stat() structure: int in range [0; 999999999].

Copy atime and mtime from src to dst:

st = os.stat(src)
atime = (math.floor(st.st_atime), st.st_atime_ns)
mtime = (math.floor(st.st_mtime), st.st_mtime_ns)
os.utime(dst, (atime, mtime))

os.utime() would accept int, float or (sec: int, nsec: int) for atime and mtime. Examples:

os.utime(name, (1, 1))
os.utime(name, (1.0, 1.0))
os.utime(name, ((1, 0), (1, 0)))
History
Date User Action Args
2012-03-04 00:19:15vstinnersetrecipients: + vstinner, gvanrossum, loewis, pitrou, larry, Arfrever, r.david.murray, rosslagerwall
2012-03-04 00:19:15vstinnersetmessageid: <1330820355.6.0.34275772598.issue14127@psf.upfronthosting.co.za>
2012-03-04 00:19:15vstinnerlinkissue14127 messages
2012-03-04 00:19:14vstinnercreate