Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. bool Wait(const unsigned long &Time) {
  2. clock_t Tick = clock_t(float(clock()) / float(CLOCKS_PER_SEC) * 1000.f);
  3. if (Tick < 0) // if clock() fails, it returns -1
  4. return 0;
  5. clock_t Now = clock_t(float(clock()) / float(CLOCKS_PER_SEC) * 1000.f);
  6. if (Now < 0)
  7. return 0;
  8. while ((Now - Tick) < Time) {
  9. Now = clock_t(float(clock()) / float(CLOCKS_PER_SEC) * 1000.f);
  10. if (Now < 0)
  11. return 0;
  12. }
  13. return 1;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement