Advertisement
apl-mhd

timedelay

Apr 13th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<time.h>
  3. void delay(unsigned int mseconds)
  4. {
  5.     clock_t goal = mseconds + clock();
  6.     while (goal > clock());
  7. }
  8. int main()
  9. {
  10.     int i;
  11.     for(i=0;i<10;i++)
  12.     {
  13.     delay(1000);
  14.     printf("This is delay function\n");
  15.     }
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement