How can i use time.h studio can you explain with an example? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can i use time.h studio can you explain with an example?

5th Sep 2016, 9:20 AM
muhammed yılmaz
muhammed yılmaz - avatar
1 Answer
0
#include <stdio.h> /* printf */ #include <time.h> /* time_t, struct tm, difftime, time, mktime */ int main () { time_t timer; struct tm y2k = {0}; double seconds; y2k.tm_hour = 0; y2k.tm_min = 0; y2k.tm_sec = 0; y2k.tm_year = 100; y2k.tm_mon = 0; y2k.tm_mday = 1; time(&timer); /* get current time; same as: timer = time(NULL) */ seconds = difftime(timer,mktime(&y2k)); printf ("%.f seconds since January 1, 2000 in the current timezone", seconds); return 0; }
12th Sep 2016, 11:14 AM
MAZHAR IMAM KHAN
MAZHAR IMAM KHAN - avatar