On 19Oct2020 1242, Steve Dower wrote:
On 15Oct2020 2239, Rob Cliffe via Python-Dev wrote:
TLDR: In os.scandir directory entries, atime is always a copy of mtime
rather than the actual access time.
Correction - os.stat() updates the access time to _now_, while
os.scandir() returns the last access time without updating it.
Let me correct myself first :)
*Windows* has decided not to update file access time metadata *in
directory entries* on reads. os.stat() always[1] looks at the file entry
metadata, while os.scandir() always looks at the directory entry metadata.
My suggested approach still applies, other than the bit where we might
fix os.stat(). The best we can do is regress os.scandir() to have
similarly poor performance, but the best *you* can do is use os.stat()
for accurate timings when files might be being modified while your
program is running, and don't do it when you just need names/kinds (and
I'm okay adding that note to the docs).
Cheers,
Steve
[1]: With some fallback to directory entries in exceptional cases that
don't apply here.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/QHHJFYEDBANW7EC3JOUFE7BQRT5ILL4O/
Code of Conduct: http://python.org/psf/codeofconduct/