time.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * This file has no copyright assigned and is placed in the Public Domain.
  3. * This file is part of the w64 mingw-runtime package.
  4. * No warranty is given; refer to the file DISCLAIMER within this package.
  5. */
  6. #ifndef _SYS_TIME_H_
  7. #define _SYS_TIME_H_
  8. #include <time.h>
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #ifndef __STRICT_ANSI__
  13. #ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */
  14. #define _TIMEVAL_DEFINED
  15. struct timeval {
  16. long tv_sec;
  17. long tv_usec;
  18. };
  19. #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
  20. #define timercmp(tvp, uvp, cmp) \
  21. (((tvp)->tv_sec != (uvp)->tv_sec) ? \
  22. ((tvp)->tv_sec cmp (uvp)->tv_sec) : \
  23. ((tvp)->tv_usec cmp (uvp)->tv_usec))
  24. #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
  25. #endif /* _TIMEVAL_DEFINED */
  26. #ifndef _TIMEZONE_DEFINED /* also in sys/time.h */
  27. #define _TIMEZONE_DEFINED
  28. /* Provided for compatibility with code that assumes that
  29. the presence of gettimeofday function implies a definition
  30. of struct timezone. */
  31. struct timezone
  32. {
  33. int tz_minuteswest; /* of Greenwich */
  34. int tz_dsttime; /* type of dst correction to apply */
  35. };
  36. extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z);
  37. #endif
  38. /*
  39. Implementation as per:
  40. The Open Group Base Specifications, Issue 6
  41. IEEE Std 1003.1, 2004 Edition
  42. The timezone pointer arg is ignored. Errors are ignored.
  43. */
  44. #ifndef _GETTIMEOFDAY_DEFINED
  45. #define _GETTIMEOFDAY_DEFINED
  46. int __cdecl gettimeofday(struct timeval *__restrict__,
  47. void *__restrict__ /* tzp (unused) */);
  48. #endif
  49. #endif /* __STRICT_ANSI__ */
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53. /* Adding timespec definition. */
  54. #include <sys/timeb.h>
  55. #endif /* _SYS_TIME_H_ */