Skip to content

Instantly share code, notes, and snippets.

@mariacamilarg
Created February 7, 2018 04:14
Show Gist options
  • Save mariacamilarg/e95022da84e2ea6234cdae721b9766e8 to your computer and use it in GitHub Desktop.
Save mariacamilarg/e95022da84e2ea6234cdae721b9766e8 to your computer and use it in GitHub Desktop.
Calculate time in C
#include <time.h>
clock_t start, end;
float cpu_time_used;
start = clock();
/* Something to measure */
end = clock();
cpu_time_used = ((float) (end - start)) / CLOCKS_PER_SEC;
printf("Time = %f\n", cpu_time_used);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment