jmilloy
jmilloy

Reputation: 8365

Why does python timeit check for win32 instead of win*?

The timeit source that I have (python 2.7) has

if sys.platform == "win32":
    # On Windows, the best timer is time.clock()
    default_timer = time.clock
else:
    # On most other platforms the best timer is time.time()
    default_timer = time.time

Yet the documentation suggests that all Windows machines behave the same

The difference in default timer function is because on Windows, clock() has microsecond granularity but time()'s granularity is 1/60th of a second...

What happens on 64-bit Windows? Is time.time actually better on 64 bit Windows?

Upvotes: 0

Views: 94

Answers (1)

Kevin
Kevin

Reputation: 76194

It appears that even 64 bit windows will tell you that its platform is "win32". I'm on a 64 bit Windows 7 system, and here's what I see:

>>> import sys
>>> sys.platform
'win32'

Consequently, 64 bit Windows will also use time.clock.

Upvotes: 3

Related Questions