STINNER Victor <victor.stin...@gmail.com> added the comment: 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))) ---------- nosy: +haypo _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14127> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com