In article <87404349-5d3a-4396-aeff-60edc14a5...@f8g2000yqn.googlegroups.com>, Paul McGuire <pt...@austin.rr.com> wrote: >On Feb 10, 2:24=A0am, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote: >> On Tue, 9 Feb 2010 21:45:38 +0000 (UTC), Grant Edwards >> <inva...@invalid.invalid> declaimed the following in >> gmane.comp.python.general: >> >> > Doesn't work. =A0datetime.datetime.now has granularity of >> > 15-16ms. >> >> > Intervals much less that that often come back with a delta of >> > 0. =A0A delay of 20ms produces a delta of either 15-16ms or >> > 31-32ms >> >> =A0 =A0 =A0 =A0 WinXP uses an ~15ms time quantum for task switching. Whic= >h defines >> the step rate of the wall clock output... >> >> http://www.eggheadcafe.com/software/aspnet/35546579/the-quantum-was-n...h= >ttp://www.eggheadcafe.com/software/aspnet/32823760/how-do-you-set-ti... >> >> http://www.lochan.org/2005/keith-cl/useful/win32time.html >> -- >> =A0 =A0 =A0 =A0 Wulfraed =A0 =A0 =A0 =A0 Dennis Lee Bieber =A0 =A0 =A0 = >=A0 =A0 =A0 =A0 KD6MOG >> =A0 =A0 =A0 =A0 wlfr...@ix.netcom.com =A0 =A0 HTTP://wlfraed.home.netcom.= >com/ > >Gabriel Genellina reports that time.clock() uses Windows' >QueryPerformanceCounter() API, which has much higher resolution than >the task switcher's 15ms. QueryPerformanceCounter's resolution is >hardware-dependent; using the Win API, and a little test program, I >get this value on my machine: >Frequency is 3579545 ticks/sec >Resolution is 0.279365114840015 microsecond/tick
In Forth we add a small machine code routine that executes the RDTSC instruction. (I used that to play music on a couple of mechanical instruments in real time.) It just counts the (3 Ghz) clock cycles in a 64 bit timer. Subtract two samples and you're done. Is there a mechanism in Python to do something similar, embedded assembler or something? (This is not a general solution, but at least it would work on Windows, that is i86 only.) > >-- Paul -- -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. alb...@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst -- http://mail.python.org/mailman/listinfo/python-list