Created
August 23, 2015 19:36
-
-
Save ufechner7/1aa3e96a8a5972864cec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import time | |
def check_sleep(amount): | |
start = datetime.now() | |
time.sleep(amount) | |
end = datetime.now() | |
delta = end-start | |
return delta.seconds + delta.microseconds/1000000. | |
error = sum(abs(check_sleep(0.050)-0.050) for i in xrange(100))*10 | |
print "Average error is %0.2fms" % error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment