GetTickCount vs. clock for msec resolution

Tim Roberts timr at probo.com
Mon Apr 23 01:30:44 EDT 2001


"Tim Peters" <tim.one at home.com> wrote:
>
>Python on Windows uses the QueryPerformanceCounter API for time.clock(),
>thanks to Mark Hammond.  How good that is (indeed, whether it even exists!)
>depends on your platform.  On my home box, it updates 1,193,180 times per
>second (use QueryPerformanceFrequency to get your magic number -- it will
>probably be the same if you're running on a Win9X Pentium).

I guarantee it will be the same on ANY Windows 9X machine.  It will also be
the same on any uniprocessor Windows NT or 2000 machine.

For those of who might not know the derivation of that number, it's an
interesting study in how a convenience can become encoded as history.  When
IBM was building the original IBM PC in 1980, their charter was to produce
it as cheaply as possible with as many off-the-shelf components as
possible.  They needed a motherboard clock of some kind for timing.  Well,
the most common crystal in the world at the time (and probably now, too!)
was the 14.31818 MHz crystal used in television flyback circuits.  This was
a little fast for their purposes, so they passed it through a divide by 12
circuit.

14,318,180 / 12 = 1,193,180, and the rest is history.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list