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

标签 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"); 

那么应该添加什么代码来在给定的计时器间隔后停止计时器

最佳答案

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

关于c++ - 如何在c中给定毫秒后停止计时器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22034095/

相关文章:

c++ - 将目录链接到标准输入

c++ - 如何正确构建相互引用的类? (C++)

c++ - 是否可以在派生类中选择性地定义类型

ios - 如何在 Swift 中的视频上叠加动态标签?

java - Android:获取一个已经启动的定时器

c++ - 在 C&C++ 中查找未初始化的变量

c - 同步和异步通信究竟是如何工作的

c - 在 Lua 中注册相同签名的 C 函数

C - 数数{制作程序}

javascript - 将php倒计时变成javascript