1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
/* $Id$ -*- C -*-
* =============================================================================
*
* = LIBRARY
* pace
*
* = FILENAME
* time.inl
*
* = AUTHOR
* Luther Baker
*
* ============================================================================= */
#include <errno.h>
extern int errno;
PACE_INLINE
char *
pace_asctime_r (const struct tm * time, char * buf)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return asctime_r (time, buf);
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_SET_ERRNO (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
return 0;
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}
PACE_INLINE
int
pace_clock_getres (clockid_t clock_id,
struct timespec * res)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return clock_getres (clock_id, res);
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_RETURN_NO_SUPPORT (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}
PACE_INLINE
int
pace_clock_gettime (clockid_t clock_id,
struct timespec * tp)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return clock_gettime (clock_id, tp);
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_RETURN_NO_SUPPORT (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}
PACE_INLINE
int
pace_clock_settime (clockid_t clock_id,
const struct timespec * tp)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return clock_settime (clock_id, tp);
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_RETURN_NO_SUPPORT (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}
PACE_INLINE
char *
pace_ctime_r (const time_t * clock, char * buf)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return ctime_r (clock, buf);
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_SETERNNO (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
return 0;
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}
PACE_INLINE
struct tm *
pace_gmtime_r (const time_t * clock, struct tm * result)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return gmtime_r (clock, result);
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_SET_ERRNO (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
return 0;
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}
PACE_INLINE
struct tm *
pace_localtime_r (const time_t * clock, struct tm * result)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return localtime_r (clock, result);
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_SET_ERRNO (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
return 0;
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}
PACE_INLINE
int
pace_nanosleep (const struct timespec * rqtp,
struct timespec * rmtp)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return nanosleep (rqtp, rmtp);
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_RETURN_NO_SUPPORT (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}
PACE_INLINE
int
pace_time (time_t * tloc)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return time (tloc);
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_RETURN_NO_SUPPORT (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}
PACE_INLINE
int
pace_timer_create (clockid_t clock_id,
struct sigevent *evp,
timer_t *timerid)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return timer_create (clock_id, evp, timerid);
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_RETURN_NO_SUPPORT (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}
PACE_INLINE
int
pace_timer_delete (timer_t timerid)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return timer_delete (timerid);
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_RETURN_NO_SUPPORT (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}
PACE_INLINE
int
pace_timer_getoverrun (timer_t timerid)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return timer_getoverrun (timerid);
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_RETURN_NO_SUPPORT (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}
PACE_INLINE
int
pace_timer_gettime (timer_t timerid,
struct itimerspec * value)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return timer_gettime (timerid, value);
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_RETURN_NO_SUPPORT (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}
PACE_INLINE
int
pace_timer_settime (timer_t timerid,
int flags,
const struct itimerspec * value,
struct itimerspec * ovalue)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return timer_settime (timerid, flags, value, ovalue);
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_RETURN_NO_SUPPORT (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}
PACE_INLINE
void
pace_tzset ()
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
tzset ();
# else /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
PACE_SET_ERRNO (PACE_ERRNO_LACKS_POSIX_PTHREAD_SEMANTICS);
# endif /* !PACE_HAS_POSIX_PTHREAD_SEMANTICS */
return;
}
|