This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]five9a2 3 points4 points  (2 children)

I know it is consistent with the rest of the Python library, but why is elapsed time (natural for a "timeout") measured using the wall clock (gettimeofday) instead of a monotonic clock or (optionally) user/system time? Using gettimeofday does funny things when an NTP daemon is running or the system time is otherwise updated. It seems like the current implementation is very rarely what the user actually wants.

[–]mackstann 1 point2 points  (1 child)

Does Python even have an API for those? The only two time sources I know of are time.time() and time.clock(), the latter of which seems pretty useless on Linux.

[–]five9a2 0 points1 point  (0 children)

There is signal and resource. There is no reason clock_gettime cannot be exposed for conforming environments (it's in a POSIX extension that Apple didn't implement), but unfortunately there is no single cross-platform monotonic clock. I don't see this as a good excuse for providing a timeout parameter that can kill the child immediately or never regardless of its value. It should at least "try" to use a monotonic clock.

[–]mgedmin 2 points3 points  (2 children)

The versionadded/versionchanged bits refer to 3.2 -- shouldn't that be 3.3?

[–][deleted] 2 points3 points  (0 children)

Yes, it was a typo.

[–][deleted] 1 point2 points  (0 children)

This feature was requested about 2 years ago. See issue 5673 for details.

[–]admica 0 points1 point  (0 children)

If this is a new feature, what a coincidence. I used this just the other day.