Last active
December 21, 2015 23:38
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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