[EMAIL PROTECTED] wrote: > Hello all > > I have the problem of how to calculate the resolution of the system > clock. > Its now two days of head sratching and still there is nothing more than > these few lines on my huge white sheet of paper stiring at me. Lame I > know. > > import time > > t1 = time.time() > while True: > t2 = time.time() > if t2 > t1: > print t1, t2 > # start calculating here > break > > > BTW t1 and t2 print out equal up to the fraction on my machine. What > does > python know that I don't? A pointer to the source lines where this is > implemented > would even be helpfull to clear this out. Can't seem to find it. > > Anyone any ideas?
I think you are pretty close: import time def resolution_sample(): t1 = time.time() while True: t2 = time.time() if t2 > t1: return t2 - t1 def timer_resolution(): return min(resolution_sample() for x in xrange(10)) The function above (timer_resolution) is actually pretty dumb. I think the number of samples to take depends on resolution. -- http://mail.python.org/mailman/listinfo/python-list