Working on Condition variables and semaphores (see 
http://bugs.python.org/issue10260) I noticed that time.time() was being used to 
correctly time blocking system calls.  On windows, I would have used 
time.clock() but reading the documentation made me realize that on Unix that 
would return CPU seconds which are useless when blocking.  However, on Windows, 
time.clock() has a much higher resolution, apart from being a "wallclock" time, 
and is thus better suited to timing that time.time().   In addition, 
time.time() has the potential of giving unexpected results if someone messes 
with the system clock.

I was wondering if it were helpful to have a function such as time.wallclock() 
which is specified to give relative wallclock time between invocations or an 
approximation thereof, to the system's best ability?

We could then choose this to be an alias of time.clock() on windows and 
time.time() on any other machine, or even have custom implementations on 
machines that support such a notion.

Kristján
_______________________________________________
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