> IOW "What's good enough for sleep() is good enough for > user-implemented timeouts and scheduling." as a way to reach at least > one decision for a platform with agreed-upon cross-platform > characteristics that are useful.
sleep() is implemented in the kernel. The kernel is notified when a clock is set, and so can choose how to handle time adjustement. Most "sleeping" functions use the system clock but don't care of clock adjustement. > I personally have a need for one potentially different clock -- to > measure short intervals for benchmarks and profiling. This might be > called time.performancetimer()? I deferred this topic because it is unclear to me if such timer has to count elapsed time during a sleep or not. For example, time.clock() does on UNIX, whereas it doesn't on Windows. You may need two clocks for this: * time.perf_counter(): high-resolution timer for benchmarking, count time elasped during a sleep * time.process_time(): High-resolution (?) per-process timer from the CPU. (other possible names: time.process_cpu_time() or time.cpu_time()) On Windows, GetProcessTimes() has not a "high-resolution": it has a accuracy of 1 ms in the best case. QueryPerformanceCounter() counts time elapsed during a sleep, I don't know for GetProcessTimes. Victor _______________________________________________ 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