Answers for "can you use time in a c program"

C
8

run time in c

#include <time.h>
clock_t begin = clock();

/* here, do your time-consuming job */

clock_t end = clock();
double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
printf("%f\n", time_spent);
Posted by: Guest on June-21-2020
2

c language time() function

/*
This function returns the time since 00:00:00 UTC, January 1, 
1970 (Unix timestamp) in seconds
*/
#include <time.h>

time_t now = time(0);
  
// Or
time_t now;
time(&now);
Posted by: Guest on March-27-2022

Code answers related to "can you use time in a c program"

Code answers related to "C"

Browse Popular Code Answers by Language