How to use sys/time.h in window?

谁说我不能喝 提交于 2020-01-27 07:15:04

问题


I am using MSVS 2006 and trying to find time in microseconds in my program. I try to call sys/time.h in the header but this error is compiled.

fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory
Error executing cl.exe.

and this is my code,

#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);
}

回答1:


Unfortunately, there is no sys\time.h header file in MSVC. Instead, try one of the following links for some help coding this on Windows.

stackoverflow 1676036

stackoverflow 2494356



来源:https://stackoverflow.com/questions/25615571/how-to-use-sys-time-h-in-window

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!