On Mar 26, 2012, at 10:26 PM, Zooko Wilcox-O'Hearn wrote:

> Note that the C++ standard deprecated monotonic_clock once they
> realized that there is absolutely no point in having a clock that
> jumps forward but not back, and that none of the operating systems
> implement such a thing -- instead they all implement a clock which
> doesn't jump in either direction.

This is why I don't like the C++ terminology, because it seems to me that the 
C++ standard makes incorrect assertions about platform behavior, and apparently 
they standardized it without actually checking on platform capabilities.

The clock does jump forward when the system suspends.  At least some existing 
implementations of steady_clock in C++ already have this problem, and I think 
they all might.  I don't think they can fully fix it without kernel changes, 
either.  On linux, see discussion of a possible CLOCK_BOOTTIME in the future.  
The only current way I know of to figure out how long the system has been 
asleep is to look at the wall clock and compare, and we've already gone over 
the problems with relying on the wall clock.

Plus, libstdc++ gives you no portable way to get informed about system power 
management events, so you can't fix it even if you know about this problem, 
natch.

Time with respect to power management state changes is something that the PEP 
should address fully, for each platform.

On the other hand, hopefully you aren't controlling your python-based CNC laser 
welder from a laptop that you are closing the lid on while the beam is in 
operation.  Not that the PEP shouldn't address it, but maybe it should just 
address it to say "you're on your own" and refer to a few platform-specific 
resources for correcting this type of discrepancy.  
(<https://developer.apple.com/library/mac/#qa/qa1340/_index.html>, 
<http://msdn.microsoft.com/en-us/library/aa394362.aspx>, 
<http://upower.freedesktop.org/docs/UPower.html#UPower::Sleeping>).

-glyph

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to