Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. void some_function(){
  2. struct timeval tstart,tend;
  3. while (1){
  4. gettimeofday (&tstart, NULL);
  5. ...
  6. Some computation
  7. ...
  8. gettimeofday (&tend, NULL);
  9. diff = (tend.tv_sec - tstart.tv_sec)*1000000L+(tend.tv_usec - tstart.tv_usec);
  10. usleep(10000-diff);
  11. }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement