C语言实现定时器
long start_time = 0;long end_time = 0;struct timeval time_now = {0};//s_time代表定时器运行的总时长,单位为秒int my_timer(int s_time){while(1){gettimeofday(&time_now,NULL);if(end_time == 0){start_time = time_now.tv_sec;}end_time = time_now.tv_sec;if((start_t
原创
2020-11-13 18:13:57 ·
1977 阅读 ·
0 评论