Skip to content

Instantly share code, notes, and snippets.

@mclaughj
Last active December 21, 2015 23:38
Show Gist options
  • Save mclaughj/6383370 to your computer and use it in GitHub Desktop.
Save mclaughj/6383370 to your computer and use it in GitHub Desktop.
A simple program to time how long it takes to count by one from 1 to 16,000,000,000,000.
#include <stdio.h>
#include <time.h>
int main(int argc, const char * argv[])
{
time_t now;
time(&now);
printf("%s", ctime(&now));
for (unsigned long i = 1; i < 16000000000000; i++) {
if (i % 1000000 == 0) {
printf("%lu\n", i);
}
}
time_t then;
time(&then);
printf("%s", ctime(&then));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment