Message173087
| Author |
trent |
| Recipients |
larry, pitrou, skrah, trent |
| Date |
2012年10月16日.20:04:43 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1350417884.01.0.0175353763499.issue15745@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I've figured out what the primary problem is on these platforms: os.stat() returns st_mtime and st_atime values with nanosecond resolution, but without a corresponding utimensat(), we can only affect time with microsecond precision via utimes().
Therefore, the following logic is faulty:
def _test_utime(self, filename, attr, utime, delta):
# Issue #13327 removed the requirement to pass None as the
# second argument. Check that the previous methods of passing
# a time tuple or None work in addition to no argument.
st0 = os.stat(filename)
# Doesn't set anything new, but sets the time tuple way
utime(filename, (attr(st0, "st_atime"), attr(st0, "st_mtime")))
# Setting the time to the time you just read, then reading again,
# should always return exactly the same times.
st1 = os.stat(filename)
self.assertEqual(attr(st0, "st_mtime"), attr(st1, "st_mtime"))
self.assertEqual(attr(st0, "st_atime"), attr(st1, "st_atime")) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年10月16日 20:04:44 | trent | set | recipients:
+ trent, pitrou, larry, skrah |
| 2012年10月16日 20:04:44 | trent | set | messageid: <1350417884.01.0.0175353763499.issue15745@psf.upfronthosting.co.za> |
| 2012年10月16日 20:04:44 | trent | link | issue15745 messages |
| 2012年10月16日 20:04:43 | trent | create |
|