Attempt to resolve gettimeofday compilation errors with MinGW64.
[bpt/emacs.git] / nt / inc / sys / time.h
CommitLineData
28dd1b41
AI
1#ifndef SYS_TIME_H_INCLUDED
2#define SYS_TIME_H_INCLUDED
3
c911543b 4/*
c06c382a
EZ
5 * sys/time.h either doesn't exist on Windows, or doesn't necessarily
6 * have the below stuff.
c911543b
GV
7 */
8
b88b62de
EZ
9/* The guards are for MinGW64, which defines these structs on its
10 system headers which are included by ms-w32.h. */
9e821c83
EZ
11/* Allow inclusion of sys/time.h and winsock2.h in any order. Needed
12 for running the configure test, which is only relevant to MinGW. */
13#ifndef _TIMEVAL_DEFINED
14#define _TIMEVAL_DEFINED
177c0ea7 15struct timeval
388cdec0
EZ
16{
17 long tv_sec; /* seconds */
18 long tv_usec; /* microseconds */
19};
9e821c83
EZ
20#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
21#define timercmp(tvp, uvp, cmp) \
22 (((tvp)->tv_sec != (uvp)->tv_sec) ? \
23 ((tvp)->tv_sec cmp (uvp)->tv_sec) : \
24 ((tvp)->tv_usec cmp (uvp)->tv_usec))
25#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
26#endif /* _TIMEVAL_DEFINED */
388cdec0 27
b88b62de 28#ifndef _TIMEZONE_DEFINED
32e2d728 29#define _TIMEZONE_DEFINED
177c0ea7 30struct timezone
388cdec0
EZ
31{
32 int tz_minuteswest; /* minutes west of Greenwich */
33 int tz_dsttime; /* type of dst correction */
34};
b88b62de 35#endif
388cdec0 36
2a157a5d 37
97dababa 38/* This needs to be compatible with Posix signature, in order to pass
2a157a5d
EZ
39 the configure test for the type of the second argument; see
40 m4/gettimeofday.m4. We use '__restrict' here, rather than
41 'restrict', for the benefit of the old nt/configure.bat build,
42 which does not force the use of -std= switch to GCC, and that
43 causes compilation errors with 'restrict', which is a C99
44 extension. */
45int gettimeofday (struct timeval *__restrict, struct timezone *__restrict);
c911543b 46
c06c382a
EZ
47#define ITIMER_REAL 0
48#define ITIMER_PROF 1
49
50struct itimerval
51{
52 struct timeval it_interval; /* timer interval */
53 struct timeval it_value; /* current value */
54};
55
56int getitimer (int, struct itimerval *);
57int setitimer (int, struct itimerval *, struct itimerval *);
58
28dd1b41
AI
59#endif /* SYS_TIME_H_INCLUDED */
60
c911543b 61/* end of sys/time.h */
ab5796a9 62