xref: /reactos/sdk/include/crt/sys/time.h (revision c2c66aff)
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 
7 #ifndef _SYS_TIME_H_
8 #define _SYS_TIME_H_
9 
10 #include <time.h>
11 
12 #ifdef  __cplusplus
13 extern "C" {
14 #endif
15 
16 #ifndef __STRICT_ANSI__
17 #ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */
18 #define _TIMEVAL_DEFINED
19 struct timeval {
20   long tv_sec;
21   long tv_usec;
22 };
23 #define timerisset(tvp)	 ((tvp)->tv_sec || (tvp)->tv_usec)
24 #define timercmp(tvp, uvp, cmp) \
25   (((tvp)->tv_sec != (uvp)->tv_sec) ? \
26   ((tvp)->tv_sec cmp (uvp)->tv_sec) : \
27   ((tvp)->tv_usec cmp (uvp)->tv_usec))
28 #define timerclear(tvp)	 (tvp)->tv_sec = (tvp)->tv_usec = 0
29 #endif /* _TIMEVAL_DEFINED */
30 
31 #ifndef _TIMEZONE_DEFINED /* also in sys/time.h */
32 #define _TIMEZONE_DEFINED
33 /* Provided for compatibility with code that assumes that
34    the presence of gettimeofday function implies a definition
35    of struct timezone. */
36 struct timezone
37 {
38   int tz_minuteswest; /* of Greenwich */
39   int tz_dsttime;     /* type of dst correction to apply */
40 };
41 
42   extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z);
43 
44 #endif
45 
46 /*
47    Implementation as per:
48    The Open Group Base Specifications, Issue 6
49    IEEE Std 1003.1, 2004 Edition
50 
51    The timezone pointer arg is ignored.  Errors are ignored.
52 */
53 #ifndef _GETTIMEOFDAY_DEFINED
54 #define _GETTIMEOFDAY_DEFINED
55 int __cdecl gettimeofday(struct timeval *__restrict__,
56                          void *__restrict__  /* tzp (unused) */);
57 #endif
58 
59 #endif /* __STRICT_ANSI__ */
60 
61 #ifdef  __cplusplus
62 }
63 #endif
64 
65 /* Adding timespec definition.  */
66 #include <sys/timeb.h>
67 
68 
69 #endif /* _SYS_TIME_H_ */
70