1 #ifndef _WINX_SYS_TIME_H_
2 #define _WINX_SYS_TIME_H_
4 #define WIN32_LEAN_AND_MEAN /* This line found to be needed by JE - 18-08-2013. Line was formerly. . . #include <features.h> */
5 #ifndef __suseconds_t_defined /* This section added by JE - 22-08-2013 */
6 #define __suseconds_t_defined
7 typedef long __suseconds_t;
8 typedef __suseconds_t suseconds_t;
10 #if !defined(BUILDING_EVORAL) && !defined(BUILDING_QMDSP) && !defined(BUILDING_VAMPPLUGINS)
11 #include <WinSock2.h> /* gets 'struct timeval' - Changed by JE - 23-07-2013. Was formerly. . . #include <WinSock.h> */
12 /* For whatever reason, Ardour's 'libevoral' refuses to build as a DLL if we include both 'rpc.h' */
13 /* and 'WinSock2.h'. It doesn't seem to matter which order we #include them. Given that we can't */
14 /* edit 'rpc.h' or 'WinSock2.h', just make sure we don't #include them when building libevoral. */
16 /* Type of the second argument to `getitimer' and
17 the second and third arguments `setitimer'. */
20 /* Value to put into `it_value' when the timer expires. */
21 struct timeval it_interval;
22 /* Time to the next timer expiration. */
23 struct timeval it_value;
27 #ifdef _TIMEVAL_DEFINED
28 # define _STRUCT_TIMEVAL 1
29 #endif /* _TIMEVAL_DEFINED */
30 //#include <bits/types.h>
33 #define __need_timeval
34 //#include <bits/time.h>
36 #ifdef _TIMEVAL_DEFINED /* also in winsock[2].h */
38 # define __TIMEVAL__ 1
39 # undef _STRUCT_TIMEVAL
40 # define _STRUCT_TIMEVAL 1
41 #endif /* _TIMEVAL_DEFINED */
48 /* Macros for converting between `struct timeval' and `struct timespec'. */
49 # define TIMEVAL_TO_TIMESPEC(tv, ts) { \
50 (ts)->tv_sec = (tv)->tv_sec; \
51 (ts)->tv_nsec = (tv)->tv_usec * 1000; \
53 # define TIMESPEC_TO_TIMEVAL(tv, ts) { \
54 (tv)->tv_sec = (ts)->tv_sec; \
55 (tv)->tv_usec = (ts)->tv_nsec / 1000; \
60 /* Structure crudely representing a timezone.
61 This is obsolete and should never be used. */
64 int tz_minuteswest; /* Minutes west of GMT. */
65 int tz_dsttime; /* Nonzero if DST is ever in effect. */
68 typedef struct timezone *__restrict __timezone_ptr_t;
70 typedef void *__restrict __timezone_ptr_t;
73 /* Get the current time of day and timezone information,
74 putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled.
75 Returns 0 on success, -1 on errors.
76 NOTE: This form of timezone information is obsolete.
77 Use the functions and variables declared in <time.h> instead. */
78 #ifdef LIBPBD_DLL /* JE - use the version that's available from libpbd */
80 LIBPBD_API int __cdecl gettimeofday (struct timeval *__restrict __tv,
81 __timezone_ptr_t __tz) __THROW;
83 __declspec(dllimport) int __cdecl gettimeofday (struct timeval *__restrict __tv,
84 __timezone_ptr_t __tz) __THROW;
87 extern int gettimeofday (struct timeval *__restrict __tv,
88 __timezone_ptr_t __tz) __THROW;
90 extern int getntptimeofday (struct timespec *__restrict __tp,
91 __timezone_ptr_t __tz) __THROW;
94 /* Set the current time of day and timezone information.
95 This call is restricted to the super-user. */
96 extern int settimeofday (__const struct timeval *__tv,
97 __const struct timezone *__tz) __THROW;
98 extern int setntptimeofday (__const struct timespec *__tp,
99 __const struct timezone *__tz) __THROW;
102 ///* Values for the first argument to `getitimer' and `setitimer'. */
103 //enum __itimer_which
105 // /* Timers run in real time. */
107 //#define ITIMER_REAL ITIMER_REAL
108 // /* Timers run only when the process is executing. */
109 // ITIMER_VIRTUAL = 1,
110 //#define ITIMER_VIRTUAL ITIMER_VIRTUAL
111 // /* Timers run when the process is executing and when
112 // the system is executing on behalf of the process. */
114 //#define ITIMER_PROF ITIMER_PROF
117 #if defined __USE_GNU && !defined __cplusplus
118 /* Use the nicer parameter type only in GNU mode and not for C++ since the
119 strict C++ rules prevent the automatic promotion. */
120 typedef enum __itimer_which __itimer_which_t;
122 typedef int __itimer_which_t;
129 #endif /*_WINX_SYS_TIMEX_H_*/