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

Maz*_*mil 10 timer visual-c++

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

lor*_*jeb 10

不幸的是,MSVC中没有sys\time.h头文件.相反,请尝试以下链接之一,以便在Windows上对此进行编码.

stackoverflow 1676036

stackoverflow 2494356