Created
December 16, 2013 21:27
-
-
Save kgriffs/7994745 to your computer and use it in GitHub Desktop.
NTPD Accuracy Testing Tools
This file contains hidden or 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
import time | |
def check(points): | |
indexes = [] | |
prev = points[0] | |
for p, i in enumerate(points[1:]): | |
if p == prev: | |
indexes.append(i) | |
prev = p | |
return indexes | |
def dump(spins): | |
points = [] | |
for x in range(1000): | |
for y in range(spins): | |
pass | |
points.append(time.time()) | |
return points | |
def test(epoch): | |
while time.time() < epoch: | |
pass | |
return dump(0) | |
points = dump(0) | |
diff = points[-1] - points[0] | |
1000 / diff | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment