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

Subversion Repositories altor32

[/] [altor32/] [trunk/] [gcc-x64/] [or1knd-elf/] [or1knd-elf/] [include/] [time.h] - Blame information for rev 35

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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