首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

求sys/time.h文件,注意不是time.h,多谢好人帮助

2013-04-20 
求sys/time.h文件,注意不是time.h,谢谢好人帮助!我最近在弄box2d,运行时发现缺少sys/time.h文件,用time.

求sys/time.h文件,注意不是time.h,谢谢好人帮助!
我最近在弄box2d,运行时发现缺少<sys/time.h>文件,用time.h编译就会出错,缺少gettimeofday()  etc...在VS中没找到,网上也搜索了好久,希望能有好心人帮助给个链接,谢谢了!好人一生平安! Visual?Studio c++ linux sys/time time.h
[解决办法]
VS下本来就没,提取给你
http://vdisk.weibo.com/s/wPulE

[解决办法]

#ifndef _SYS_TIME_H_
#define _SYS_TIME_H_
#include <time.h>

#ifdef__cplusplus
extern "C" {
#endif

#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */
#define _TIMEVAL_DEFINED
struct timeval {
  long tv_sec;
  long tv_usec;
};
#define timerisset(tvp) ((tvp)->tv_sec 
[解决办法]
 (tvp)->tv_usec)
#define timercmp(tvp, uvp, cmp) \
(((tvp)->tv_sec != (uvp)->tv_sec) ? \
((tvp)->tv_sec cmp (uvp)->tv_sec) : \
((tvp)->tv_usec cmp (uvp)->tv_usec))
#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
#endif /* _TIMEVAL_DEFINED */

/* Provided for compatibility with code that assumes that
   the presence of gettimeofday function implies a definition
   of struct timezone. */
struct timezone
{
  int tz_minuteswest; /* of Greenwich */
  int tz_dsttime;     /* type of dst correction to apply */
};

/*
   Implementation as per:
   The Open Group Base Specifications, Issue 6
   IEEE Std 1003.1, 2004 Edition

   The timezone pointer arg is ignored.  Errors are ignored.
*/ 
int __cdecl __MINGW_NOTHROW gettimeofday(struct timeval *__restrict__,
 void *__restrict__  /*tzp (unused) */);

#ifdef__cplusplus
}
#endif


#endif /* _SYS_TIME_H_ */

热点排行