如何在c中给定的毫秒后停止计时器

时间:2014-02-26 07:01:43

标签: c++ c timer milliseconds

 #include <stdio.h>
#include <time.h>   
int main (void)
{
double diff = 0.0;
time_t start;
time_t stop;
time(&start);
print("Enter millisecond to stop"); 

那么在给定的计时器间隔

之后,代码应该添加到停止计时器

1 个答案:

答案 0 :(得分:1)

int seconds;
scanf ("%d",&seconds);
stop = 0;
while (stop < start + seconds)
    time(&stop);