OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [include/] [time.h] - Blame information for rev 158

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/*
2
 * time.h
3
 *
4
 * Struct and function declarations for dealing with time.
5
 */
6
 
7
#ifndef _TIME_H_
8
#define _TIME_H_
9
 
10
#include "_ansi.h"
11
#include <sys/reent.h>
12
 
13
#ifndef NULL
14
#define NULL    0
15
#endif
16
 
17
/* Get _CLOCKS_PER_SEC_ */
18
#include <machine/time.h>
19
 
20
#ifndef _CLOCKS_PER_SEC_
21
#define _CLOCKS_PER_SEC_ 1000
22
#endif
23
 
24
#define CLOCKS_PER_SEC _CLOCKS_PER_SEC_
25
#define CLK_TCK CLOCKS_PER_SEC
26
#define __need_size_t
27
#include <stddef.h>
28
 
29
#include <sys/types.h>
30
 
31
_BEGIN_STD_C
32
 
33
struct tm
34
{
35
  int   tm_sec;
36
  int   tm_min;
37
  int   tm_hour;
38
  int   tm_mday;
39
  int   tm_mon;
40
  int   tm_year;
41
  int   tm_wday;
42
  int   tm_yday;
43
  int   tm_isdst;
44
};
45
 
46
clock_t    _EXFUN(clock,    (void));
47
double     _EXFUN(difftime, (time_t _time2, time_t _time1));
48
time_t     _EXFUN(mktime,   (struct tm *_timeptr));
49
time_t     _EXFUN(time,     (time_t *_timer));
50
#ifndef _REENT_ONLY
51
char      *_EXFUN(asctime,  (const struct tm *_tblock));
52
char      *_EXFUN(ctime,    (const time_t *_time));
53
struct tm *_EXFUN(gmtime,   (const time_t *_timer));
54
struct tm *_EXFUN(localtime,(const time_t *_timer));
55
#endif
56
size_t     _EXFUN(strftime, (char *_s, size_t _maxsize, const char *_fmt, const struct tm *_t));
57
 
58
char      *_EXFUN(asctime_r,    (const struct tm *, char *));
59
char      *_EXFUN(ctime_r,      (const time_t *, char *));
60
struct tm *_EXFUN(gmtime_r,     (const time_t *, struct tm *));
61
struct tm *_EXFUN(localtime_r,  (const time_t *, struct tm *));
62
 
63
_END_STD_C
64
 
65
#ifdef __cplusplus
66
extern "C" {
67
#endif
68
 
69
#ifndef __STRICT_ANSI__
70
char      *_EXFUN(strptime,     (const char *, const char *, struct tm *));
71
_VOID      _EXFUN(tzset,        (_VOID));
72
_VOID      _EXFUN(_tzset_r,     (struct _reent *));
73
 
74
typedef struct __tzrule_struct
75
{
76
  char ch;
77
  int m;
78
  int n;
79
  int d;
80
  int s;
81
  time_t change;
82
  long offset; /* Match type of _timezone. */
83
} __tzrule_type;
84
 
85
typedef struct __tzinfo_struct
86
{
87
  int __tznorth;
88
  int __tzyear;
89
  __tzrule_type __tzrule[2];
90
} __tzinfo_type;
91
 
92
__tzinfo_type *_EXFUN (__gettzinfo, (_VOID));
93
 
94
/* getdate functions */
95
 
96
#ifdef HAVE_GETDATE
97
#ifndef _REENT_ONLY
98
#define getdate_err (*__getdate_err())
99
int *_EXFUN(__getdate_err,(_VOID));
100
 
101
struct tm *     _EXFUN(getdate, (const char *));
102
/* getdate_err is set to one of the following values to indicate the error.
103
     1  the DATEMSK environment variable is null or undefined,
104
     2  the template file cannot be opened for reading,
105
     3  failed to get file status information,
106
     4  the template file is not a regular file,
107
     5  an error is encountered while reading the template file,
108
     6  memory allication failed (not enough memory available),
109
     7  there is no line in the template that matches the input,
110
     8  invalid input specification  */
111
#endif /* !_REENT_ONLY */
112
 
113
/* getdate_r returns the error code as above */
114
int             _EXFUN(getdate_r, (const char *, struct tm *));
115
#endif /* HAVE_GETDATE */
116
 
117
/* defines for the opengroup specifications Derived from Issue 1 of the SVID.  */
118
extern __IMPORT long _timezone;
119
extern __IMPORT int _daylight;
120
extern __IMPORT char *_tzname[2];
121
 
122
/* POSIX defines the external tzname being defined in time.h */
123
#ifndef tzname
124
#define tzname _tzname
125
#endif
126
#endif /* !__STRICT_ANSI__ */
127
 
128
#ifdef __cplusplus
129
}
130
#endif
131
 
132
#include <sys/features.h>
133
 
134
#ifdef __CYGWIN__
135
#include <cygwin/time.h>
136
#endif /*__CYGWIN__*/
137
 
138
#if defined(_POSIX_TIMERS)
139
 
140
#include <signal.h>
141
 
142
#ifdef __cplusplus
143
extern "C" {
144
#endif
145
 
146
/* Clocks, P1003.1b-1993, p. 263 */
147
 
148
int _EXFUN(clock_settime, (clockid_t clock_id, const struct timespec *tp));
149
int _EXFUN(clock_gettime, (clockid_t clock_id, struct timespec *tp));
150
int _EXFUN(clock_getres,  (clockid_t clock_id, struct timespec *res));
151
 
152
/* Create a Per-Process Timer, P1003.1b-1993, p. 264 */
153
 
154
int _EXFUN(timer_create,
155
  (clockid_t clock_id, struct sigevent *evp, timer_t *timerid));
156
 
157
/* Delete a Per_process Timer, P1003.1b-1993, p. 266 */
158
 
159
int _EXFUN(timer_delete, (timer_t timerid));
160
 
161
/* Per-Process Timers, P1003.1b-1993, p. 267 */
162
 
163
int _EXFUN(timer_settime,
164
  (timer_t timerid, int flags, const struct itimerspec *value,
165
   struct itimerspec *ovalue));
166
int _EXFUN(timer_gettime, (timer_t timerid, struct itimerspec *value));
167
int _EXFUN(timer_getoverrun, (timer_t timerid));
168
 
169
/* High Resolution Sleep, P1003.1b-1993, p. 269 */
170
 
171
int _EXFUN(nanosleep, (const struct timespec  *rqtp, struct timespec *rmtp));
172
 
173
#ifdef __cplusplus
174
}
175
#endif
176
#endif /* _POSIX_TIMERS */
177
 
178
#ifdef __cplusplus
179
extern "C" {
180
#endif
181
 
182
/* CPU-time Clock Attributes, P1003.4b/D8, p. 54 */
183
 
184
/* values for the clock enable attribute */
185
 
186
#define CLOCK_ENABLED  1  /* clock is enabled, i.e. counting execution time */
187
#define CLOCK_DISABLED 0  /* clock is disabled */
188
 
189
/* values for the pthread cputime_clock_allowed attribute */
190
 
191
#define CLOCK_ALLOWED    1 /* If a thread is created with this value a */
192
                           /*   CPU-time clock attached to that thread */
193
                           /*   shall be accessible. */
194
#define CLOCK_DISALLOWED 0 /* If a thread is created with this value, the */
195
                           /*   thread shall not have a CPU-time clock */
196
                           /*   accessible. */
197
 
198
/* Manifest Constants, P1003.1b-1993, p. 262 */
199
 
200
#define CLOCK_REALTIME (clockid_t)1
201
 
202
/* Flag indicating time is "absolute" with respect to the clock
203
   associated with a time.  */
204
 
205
#define TIMER_ABSTIME   4
206
 
207
/* Manifest Constants, P1003.4b/D8, p. 55 */
208
 
209
#if defined(_POSIX_CPUTIME)
210
 
211
/* When used in a clock or timer function call, this is interpreted as
212
   the identifier of the CPU_time clock associated with the PROCESS
213
   making the function call.  */
214
 
215
#define CLOCK_PROCESS_CPUTIME (clockid_t)2
216
 
217
#endif
218
 
219
#if defined(_POSIX_THREAD_CPUTIME)
220
 
221
/*  When used in a clock or timer function call, this is interpreted as
222
    the identifier of the CPU_time clock associated with the THREAD
223
    making the function call.  */
224
 
225
#define CLOCK_THREAD_CPUTIME (clockid_t)3
226
 
227
#endif
228
 
229
#if defined(_POSIX_MONOTONIC_CLOCK)
230
 
231
/*  The identifier for the system-wide monotonic clock, which is defined
232
 *      as a clock whose value cannot be set via clock_settime() and which
233
 *          cannot have backward clock jumps. */
234
 
235
#define CLOCK_MONOTONIC (clockid_t)4
236
 
237
#endif
238
 
239
#if defined(_POSIX_CPUTIME)
240
 
241
/* Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55 */
242
 
243
int _EXFUN(clock_getcpuclockid, (pid_t pid, clockid_t *clock_id));
244
 
245
#endif /* _POSIX_CPUTIME */
246
 
247
#if defined(_POSIX_CPUTIME) || defined(_POSIX_THREAD_CPUTIME)
248
 
249
/* CPU-time Clock Attribute Access, P1003.4b/D8, p. 56 */
250
 
251
int _EXFUN(clock_setenable_attr, (clockid_t clock_id, int attr));
252
int _EXFUN(clock_getenable_attr, (clockid_t clock_id, int *attr));
253
 
254
#endif /* _POSIX_CPUTIME or _POSIX_THREAD_CPUTIME */
255
 
256
#ifdef __cplusplus
257
}
258
#endif
259
 
260
#endif /* _TIME_H_ */
261
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.