Re: time.time or time.clock



dwblas@xxxxxxxxx wrote:
"""
<snipped>
time.clock() isn't high enough resolution for Ubuntu, and time.time()
isn't > high enough resolution on windows.

Take a look at datetime. It is good to the micro-second on Linux and
milli-second on Windows.

datetime.datetime.now() does the same thing as time.time(); it uses the gettimeofday() API for platforms that have it (and so does time.time()), and calls the fallback implementation in time.time() if gettimeofdat() isn't supported. from the datetime sources:

#ifdef HAVE_GETTIMEOFDAY
struct timeval t;
#ifdef GETTIMEOFDAY_NO_TZ
gettimeofday(&t);
#else
gettimeofday(&t, (struct timezone *)NULL);
#endif
...
#else /* ! HAVE_GETTIMEOFDAY */

/* No flavor of gettimeofday exists on this platform. Python's
* time.time() does a lot of other platform tricks to get the
* best time it can on the platform, and we're not going to do
* better than that (if we could, the better code would belong
* in time.time()!) We're limited by the precision of a double,
* though.
*/

(note the "if we could" part).

</F>

.



Relevant Pages

  • Re: time.time or time.clock
    ... high enough resolution on windows. ... Take a look at datetime. ...
    (comp.lang.python)
  • Re: time.time or time.clock
    ... high enough resolution on windows. ... Windows time.time appears to tick at 15 or 16 ms intervals, ... /* No flavor of gettimeofday exists on this platform. ...
    (comp.lang.python)
  • Re: Where can I find the definition of USER_TIMER_MINIMUM?
    ... 20ms on 2003 platform. ... I wonder if windows 2003 can meet my requirement. ... WM_TIMER max resolution is 55msecs, you want a multimedia timer. ...
    (microsoft.public.win32.programmer.messaging)
  • Re: client -server interaction over XML supporting multiple protocols
    ... > analyzing various models to develop the server. ... The Windows WinInet at just the socket layer is also very ... expected to be different for each platform. ... will the XML size constraints significantly hinder the request ...
    (comp.lang.cpp)
  • Re: It is almost certain now, INTEL will have 64bit x86 !!
    ... >>IA64 boxes, and then support them on the 8086, on to of the original ... Its difficult to see what future the Windows on IPF port has ... Windows on Itanium was always more of a marketing exercise allowing ... But the introduction of Windows on AMD64 and Intels new platform ...
    (comp.os.vms)