小编Maz*_*mil的帖子

如何在窗口中使用sys/time.h?

我正在使用MSVS 2006并试图在我的程序中找到微秒的时间.我尝试在标头中调用sys/time.h但是编译了这个错误.

fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory
Error executing cl.exe.
Run Code Online (Sandbox Code Playgroud)

这是我的代码,

#include<sys/time.h>
#include<stdio.h>
int main()
{
   struc timeval stop,start;
   gettimeofday(&start,NULL);

   /*my function here*/

   gettimeofday(&stop,NULL);
   printf("took %lu usec\n",stop.tv_usec-start.tv_usec);
}
Run Code Online (Sandbox Code Playgroud)

timer visual-c++

10
推荐指数
1
解决办法
7万
查看次数

标签 统计

timer ×1

visual-c++ ×1