[Python-Dev] time.wallclock() (original) (raw)
Michael Foord fuzzyman at voidspace.org.uk
Mon Nov 1 15:05:14 CET 2010
- Previous message: [Python-Dev] time.wallclock()
- Next message: [Python-Dev] time.wallclock()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 01/11/2010 14:00, Kristján Valur Jónsson wrote:
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.
I think this would be helpful. Having to do platform specific checks to choose which time function to use is annoying.
Michael
Kristján
Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk
--
READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.
-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20101101/4cac4320/attachment.html>
- Previous message: [Python-Dev] time.wallclock()
- Next message: [Python-Dev] time.wallclock()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]