summaryrefslogtreecommitdiff
path: root/PACE/pace/win32/time.inl
blob: cc8f251bf9198d61b2e43c1e3473177e076b7f05 (plain)
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/* $Id$ -*- C -*-

 * =============================================================================
 *
 * = LIBRARY
 *    pace
 *
 * = FILENAME
 *    pace/win32/time.inl
 *
 * = AUTHOR
 *    Luther Baker
 *
 * ============================================================================= */

#include <errno.h>
extern int errno;

PACE_INLINE
char *
pace_asctime (const struct tm * time)
{
  return asctime (time);
}

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_UNUSED_ARG (time);
  PACE_UNUSED_ARG (buf);
  PACE_ERRNO_NO_SUPPORT ();
  return 0;
# endif /* ! PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}

PACE_INLINE
pace_clock_t
pace_clock (void)
{
  return clock ();
}

PACE_INLINE
double
pace_difftime (pace_time_t time1, pace_time_t time2)
{
  return difftime (time1, time2);
}

PACE_INLINE
int
pace_clock_getres (clockid_t clock_id,
                   struct timespec * res)
{
  return clock_getres (clock_id, res);
}

PACE_INLINE
int
pace_clock_gettime (clockid_t clock_id,
                    struct timespec * tp)
{
  return clock_gettime (clock_id, tp);
}

PACE_INLINE
int
pace_clock_settime (clockid_t clock_id,
                    const struct timespec * tp)
{
  return clock_settime (clock_id, tp);
}

PACE_INLINE
char *
pace_ctime (const time_t * clock)
{
  return ctime (clock);
}

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_UNUSED_ARG (clock);
  PACE_UNUSED_ARG (buf);
  PACE_ERRNO_NO_SUPPORT ();
  return 0;
# endif /* ! PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}

PACE_INLINE
struct tm *
pace_gmtime (const time_t * clock)
{
  return gmtime (clock);
}

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_UNUSED_ARG (clock);
  PACE_UNUSED_ARG (result);
  PACE_ERRNO_NO_SUPPORT ();
  return 0;
# endif /* ! PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}

PACE_INLINE
struct tm *
pace_localtime (const time_t * clock)
{
  return localtime (clock);
}

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_UNUSED_ARG (clock);
  PACE_UNUSED_ARG (result);
  PACE_ERRNO_NO_SUPPORT ();
  return 0;
# endif /* ! PACE_HAS_POSIX_PTHREAD_SEMANTICS */
}

PACE_INLINE
time_t
pace_mktime (struct tm * timeptr)
{
  return mktime (timeptr);
}

PACE_INLINE
int
pace_nanosleep (const struct timespec * rqtp,
                struct timespec * rmtp)
{
  return nanosleep (rqtp, rmtp);
}

PACE_INLINE
size_t
pace_strftime (char *s, size_t maxsize,
               const char *format,
               const struct tm *timeptr)
{
  return strftime (s, maxsize, format, timeptr);
}

PACE_INLINE
time_t
pace_time (time_t * tloc)
{
  return time (tloc);
}

PACE_INLINE
int
pace_timer_create (clockid_t clock_id,
                   struct sigevent *evp,
                   timer_t *timerid)
{
  return timer_create (clock_id, evp, timerid);
}

PACE_INLINE
int
pace_timer_delete (timer_t timerid)
{
  return timer_delete (timerid);
}

PACE_INLINE
int
pace_timer_getoverrun (timer_t timerid)
{
  return timer_getoverrun (timerid);
}

PACE_INLINE
int
pace_timer_gettime (timer_t timerid,
                    struct itimerspec * value)
{
  return timer_gettime (timerid, value);
}

PACE_INLINE
int
pace_timer_settime (timer_t timerid,
                    int flags,
                    const struct itimerspec * value,
                    struct itimerspec * ovalue)
{
  return timer_settime (timerid, flags, value, ovalue);
}

PACE_INLINE
void
pace_tzset ()
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
  tzset ();
# else /* ! PACE_HAS_POSIX_PTHREAD_SEMANTICS */
  PACE_ERRNO_NO_SUPPORT ();
# endif /* ! PACE_HAS_POSIX_PTHREAD_SEMANTICS */
  return;
}