Merge branch 'master' into windows
[ardour.git] / msvc_extra_headers / ardourext / sys / time.h.input
1 #ifndef _WINX_SYS_TIME_H_
2 #define _WINX_SYS_TIME_H_
3
4 //#include <features.h>
5 #include <WinSock2.h> // gets 'struct timeval' - Changed by JE - 23-07-2013. Was formerly. . . #include <WinSock.h>
6
7 #ifdef _TIMEVAL_DEFINED
8 # define _STRUCT_TIMEVAL     1
9 #endif /* _TIMEVAL_DEFINED */
10 //#include <bits/types.h>
11 #define __need_time_t
12 #include <time.h>
13 #define __need_timeval
14 //#include <bits/time.h>
15
16 #ifdef _TIMEVAL_DEFINED /* also in winsock[2].h */
17 # undef __TIMEVAL__
18 # define __TIMEVAL__ 1
19 # undef _STRUCT_TIMEVAL
20 # define _STRUCT_TIMEVAL     1
21 #endif /* _TIMEVAL_DEFINED */
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #ifdef __USE_GNU
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;                           \
32 }
33 # define TIMESPEC_TO_TIMEVAL(tv, ts) {                                   \
34         (tv)->tv_sec = (ts)->tv_sec;                                    \
35         (tv)->tv_usec = (ts)->tv_nsec / 1000;                           \
36 }
37 #endif
38
39 #ifdef __USE_BSD
40 /* Structure crudely representing a timezone.
41    This is obsolete and should never be used.  */
42 struct timezone
43   {
44     int tz_minuteswest;       /* Minutes west of GMT.  */
45     int tz_dsttime;      /* Nonzero if DST is ever in effect.  */
46   };
47
48 typedef struct timezone *__restrict __timezone_ptr_t;
49 #else
50 typedef void *__restrict __timezone_ptr_t;
51 #endif
52
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;
60
61 extern int getntptimeofday (struct timespec *__restrict __tp,
62                 __timezone_ptr_t __tz) __THROW;
63
64 #ifdef __USE_BSD
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;
71 #endif
72
73 ///* Values for the first argument to `getitimer' and `setitimer'.  */
74 //enum __itimer_which
75 //  {
76 //    /* Timers run in real time.  */
77 //    ITIMER_REAL = 0,
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.  */
84 //    ITIMER_PROF = 2
85 //#define ITIMER_PROF ITIMER_PROF
86 //  };
87
88 /* Type of the second argument to `getitimer' and
89    the second and third arguments `setitimer'.  */
90 struct itimerval
91   {
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;
96   };
97
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;
102 #else
103 typedef int __itimer_which_t;
104 #endif
105
106 #ifdef __cplusplus
107 }
108 #endif
109
110 #endif /*_WINX_SYS_TIMEX_H_*/