Guest User

Untitled

a guest
Apr 19th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #!/user/bin/php
  2. $start = microtime(true);
  3. set_time_limit(60);
  4. for (i = 0; i < 59; ++$i) {
  5. doMyThings();
  6. time_sleep_until($start + $i + 1);
  7. }
  8.  
  9. set_time_limit(60);
  10. for (i = 0; i < 59; ++$i) {
  11. doMyThings();
  12. sleep(1);
  13. }
  14.  
  15. $start = microtime(true);
  16. set_time_limit(60);
  17. for (i = 0; i < 59; ++$i) {
  18. doMyThings();
  19. time_sleep_until($start + $i + 1);
  20. }
  21.  
  22. #!/user/bin/php
  23. <?php
  24. while($i < 60) {
  25. sleep(1);
  26. //do stuff
  27. $i++;
  28. }
  29. ?>
  30.  
  31. #!/usr/bin/php
  32. <?
  33. $start = microtime(true);
  34. set_time_limit(60);
  35. for ($i = 0; $i < 59; ++$i) {
  36. echo $i;
  37. time_sleep_until($start + $i + 1);
  38. }
  39. ?>
Add Comment
Please, Sign In to add comment