标签:tar div localtime %s == color puts span int
#include <stdio.h> /* puts, printf */ #include <time.h> /* time_t, struct tm, time, localtime */ int main () { struct tm * timeinfo; double seconds; time_t start_time,now; time (&start_time); while(1){ time (&now); seconds = difftime(now,start_time); if(seconds==5){ break; } } timeinfo = localtime (&start_time); printf ("start_time local time and date: %s", asctime(timeinfo)); timeinfo = localtime (&now); printf ("now local time and date: %s", asctime(timeinfo)); printf("time spend %f\n",seconds); return 0; }
输出
start_time local time and date: Fri May 24 10:24:40 2019 now local time and date: Fri May 24 10:24:45 2019 time spend 5.000000
标签:tar div localtime %s == color puts span int
原文地址:https://www.cnblogs.com/sea-stream/p/10916525.html