Farrk

ticks_measurement

Dec 18th, 2013
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. local pw=0
  2. local pc=0
  3. local sleepTime=1
  4. if not os.getComputerLabel() then
  5. for i=1,60 do
  6. local s=http.get("http://timeapi.netii.net/index.php")
  7. pw=s.readLine()
  8. measure=1000/((pw-pc)/20)
  9. if measure<19 then
  10. sleepTime=sleepTime-0.01
  11. end
  12. pc=pw
  13. print(sleepTime)
  14. sleep(sleepTime)
  15. end
  16. os.setComputerLabel(tostring(sleepTime))
  17. else
  18. sleepTime=tonumber(os.getComputerLabel())
  19. end
  20. while 1 do
  21. local s=http.get("http://timeapi.netii.net/index.php")
  22. pw=s.readLine()
  23. ticks3=1000/((pw-pc)/20)
  24. shell.run("clear")
  25. print("Current t/s:"..tostring(ticks3))
  26. pc=pw
  27. sleep(sleepTime)
  28. end
Advertisement
Add Comment
Please, Sign In to add comment