我正在使用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)