2 Copyright (c) 2011 mingw-w64 project
4 Permission is hereby granted, free of charge, to any person obtaining a
5 copy of this software and associated documentation files (the "Software"),
6 to deal in the Software without restriction, including without limitation
7 the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and/or sell copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 DEALINGS IN THE SOFTWARE.
23 #include <sys/timeb.h>
25 #ifndef WIN_PTHREADS_TIME_H
26 #define WIN_PTHREADS_TIME_H
28 /* Posix timers are supported */
30 #define _POSIX_TIMERS 200809L
33 /* Monotonic clocks are available. */
34 #ifndef _POSIX_MONOTONIC_CLOCK
35 #define _POSIX_MONOTONIC_CLOCK 200809L
38 /* CPU-time clocks are available. */
39 #ifndef _POSIX_CPUTIME
40 #define _POSIX_CPUTIME 200809L
43 /* Clock support in threads are available. */
44 #ifndef _POSIX_THREAD_CPUTIME
45 #define _POSIX_THREAD_CPUTIME 200809L
48 #ifndef __clockid_t_defined
49 typedef int clockid_t;
50 #define __clockid_t_defined 1
51 #endif /* __clockid_t_defined */
54 #define TIMER_ABSTIME 1
57 #ifndef CLOCK_REALTIME
58 #define CLOCK_REALTIME 0
61 #ifndef CLOCK_MONOTONIC
62 #define CLOCK_MONOTONIC 1
65 #ifndef CLOCK_PROCESS_CPUTIME_ID
66 #define CLOCK_PROCESS_CPUTIME_ID 2
69 #ifndef CLOCK_THREAD_CPUTIME_ID
70 #define CLOCK_THREAD_CPUTIME_ID 3
77 /* Make sure we provide default for WINPTHREAD_API, if not defined. */
78 #pragma push_macro("WINPTHREAD_API")
79 #ifndef WINPTHREAD_API
80 #define WINPTHREAD_API
83 /* These should really be dllimport'ed if using winpthread dll */
84 int __cdecl WINPTHREAD_API nanosleep(const struct timespec *request, struct timespec *remain);
86 int __cdecl WINPTHREAD_API clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *request, struct timespec *remain);
87 int __cdecl WINPTHREAD_API clock_getres(clockid_t clock_id, struct timespec *res);
88 int __cdecl WINPTHREAD_API clock_gettime(clockid_t clock_id, struct timespec *tp);
89 int __cdecl WINPTHREAD_API clock_settime(clockid_t clock_id, const struct timespec *tp);
91 #pragma pop_macro("WINPTHREAD_API")
97 #endif /* WIN_PTHREADS_TIME_H */