How to implement high precision sleep by using Python?

122 Views Asked by At

I'm currently doing a research which I need to implement high precision sleep function, within 10-100 (us) microsecond accuracy, is there has any possible method I can achieve that? I tried to use time.sleep(50/1000000), but it not working. This code is I tried in my Mac,

import time

print(time.time())
seconds = 10
time.sleep(seconds/1000000.0)
print(time.time())

The accuracy is closer to 1000 us, but I hope to get higher precision.

If Python cannot achieve that, is there any other language can achieve that?

0

There are 0 best solutions below