Guest User

Untitled

a guest
May 4th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. void AwesomO::Sleep(unsigned long miliseconds) throw(...)
  2. {
  3. unsigned long remaining = miliseconds;
  4.  
  5. clock_t t1=clock();
  6. clock_t t2;
  7.  
  8. while (remaining > 0)
  9. {
  10. t2=clock();
  11. //Chat("T2-T1: %u", (t2-t1));
  12. if ((t2-t1) >= miliseconds)
  13. break;
  14.  
  15. if (remaining >= 10)
  16. {
  17. ::Sleep(10);
  18. remaining -= 10;
  19. }
  20. else if (remaining < 10)
  21. {
  22. ::Sleep(remaining);
  23. remaining -= remaining;
  24. }
  25. Tasks();
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment