C语言基础:通过difftime判断时间间隔延迟执行
#include <stdio.h> #include <time.h> int main (void) { time_t start_time; time_t current_time; time(&start_time); printf("About to delay 5 seconds\n"); do { time(¤t_time); } while (difftime(current_time, start_time) < 5.0); printf("Done\n"); return 1; }