Skip to content

Instantly share code, notes, and snippets.

@danrl
Created May 23, 2018 19:35
Show Gist options
  • Save danrl/bb3bbad695422ee1593b7b47bdac83a6 to your computer and use it in GitHub Desktop.
Save danrl/bb3bbad695422ee1593b7b47bdac83a6 to your computer and use it in GitHub Desktop.
#include <time.h>
int main(int argc, char *argv[]) {
// run for 10 seconds
time_t end = time(0) + 10;
// do something
volatile int i;
while (time(0) < end) {
i++;
}
// exit ok
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment