1 #ifndef _WINX_SYS_TIME_H_
2 #define _WINX_SYS_TIME_H_
4 //#include <features.h>
5 #include <WinSock2.h> // gets 'struct timeval' - Changed by JE - 23-07-2013. Was formerly. . . #include <WinSock.h>
7 #ifdef _TIMEVAL_DEFINED
8 # define _STRUCT_TIMEVAL 1
9 #endif /* _TIMEVAL_DEFINED */
10 //#include <bits/types.h>
13 #define __need_timeval
14 //#include <bits/time.h>
16 #ifdef _TIMEVAL_DEFINED /* also in winsock[2].h */
18 # define __TIMEVAL__ 1
19 # undef _STRUCT_TIMEVAL
20 # define _STRUCT_TIMEVAL 1
21 #endif /* _TIMEVAL_DEFINED */
28 /* Macros for converting between `struct timeval' and `struct timespec'. */
29 # define TIMEVAL_TO_TIMESPEC(tv, ts) { \
30 (ts)->tv_sec = (tv)->tv_sec; \
31 (ts)->tv_nsec = (tv)->tv_usec * 1000; \
33 # define TIMESPEC_TO_TIMEVAL(tv, ts) { \
34 (tv)->tv_sec = (ts)->tv_sec; \
35 (tv)->tv_usec = (ts)->tv_nsec / 1000; \
40 /* Structure crudely representing a timezone.
41 This is obsolete and should never be used. */
44 int tz_minuteswest; /* Minutes west of GMT. */
45 int tz_dsttime; /* Nonzero if DST is ever in effect. */
48 typedef struct timezone *__restrict __timezone_ptr_t;
50 typedef void *__restrict __timezone_ptr_t;
53 /* Get the current time of day and timezone information,
54 putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled.
55 Returns 0 on success, -1 on errors.
56 NOTE: This form of timezone information is obsolete.
57 Use the functions and variables declared in <time.h> instead. */
58 extern int gettimeofday (struct timeval *__restrict __tv,
59 __timezone_ptr_t __tz) __THROW;
61 extern int getntptimeofday (struct timespec *__restrict __tp,
62 __timezone_ptr_t __tz) __THROW;
65 /* Set the current time of day and timezone information.
66 This call is restricted to the super-user. */
67 extern int settimeofday (__const struct timeval *__tv,
68 __const struct timezone *__tz) __THROW;
69 extern int setntptimeofday (__const struct timespec *__tp,
70 __const struct timezone *__tz) __THROW;
73 ///* Values for the first argument to `getitimer' and `setitimer'. */
76 // /* Timers run in real time. */
78 //#define ITIMER_REAL ITIMER_REAL
79 // /* Timers run only when the process is executing. */
80 // ITIMER_VIRTUAL = 1,
81 //#define ITIMER_VIRTUAL ITIMER_VIRTUAL
82 // /* Timers run when the process is executing and when
83 // the system is executing on behalf of the process. */
85 //#define ITIMER_PROF ITIMER_PROF
88 /* Type of the second argument to `getitimer' and
89 the second and third arguments `setitimer'. */
92 /* Value to put into `it_value' when the timer expires. */
93 struct timeval it_interval;
94 /* Time to the next timer expiration. */
95 struct timeval it_value;
98 #if defined __USE_GNU && !defined __cplusplus
99 /* Use the nicer parameter type only in GNU mode and not for C++ since the
100 strict C++ rules prevent the automatic promotion. */
101 typedef enum __itimer_which __itimer_which_t;
103 typedef int __itimer_which_t;
110 #endif /*_WINX_SYS_TIMEX_H_*/