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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [sys/] [linux/] [include/] [time.h] - Blame information for rev 816

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
 
9
#include "_ansi.h"
10
#include <sys/reent.h>
11
#include <sys/linux_time.h>
12
 
13
#ifdef __cplusplus
14
extern "C" {
15
#endif
16
 
17
#ifndef NULL
18
#define NULL    0
19
#endif
20
 
21
/* Get _CLOCKS_PER_SEC_ */
22
#include <machine/time.h>
23
#include <sys/types.h>
24
 
25
/* Time Value Specification Structures, P1003.1b-1993, p. 261 */
26
#ifndef _STRUCT_TIMESPEC
27
#define _STRUCT_TIMESPEC
28
struct timespec {
29
  time_t  tv_sec;   /* Seconds */
30
  long    tv_nsec;  /* Nanoseconds */
31
};
32
#endif /* !_STRUCT_TIMESPEC */
33
 
34
#ifndef __need_timespec
35
 
36
#define _TIME_H_ 1
37
 
38
#ifndef _CLOCKS_PER_SEC_
39
#define _CLOCKS_PER_SEC_ 1000
40
#endif
41
 
42
#define CLOCKS_PER_SEC _CLOCKS_PER_SEC_
43
#define CLK_TCK CLOCKS_PER_SEC
44
#define __need_size_t
45
#include <stddef.h>
46
 
47
struct tm
48
{
49
  int   tm_sec;
50
  int   tm_min;
51
  int   tm_hour;
52
  int   tm_mday;
53
  int   tm_mon;
54
  int   tm_year;
55
  int   tm_wday;
56
  int   tm_yday;
57
  int   tm_isdst;
58
};
59
 
60
#ifndef __timer_t_defined
61
# define __timer_t_defined      1
62
typedef __timer_t timer_t;
63
#endif
64
 
65
clock_t    _EXFUN(clock,    (void));
66
double     _EXFUN(difftime, (time_t _time2, time_t _time1));
67
time_t     _EXFUN(mktime,   (struct tm *_timeptr));
68
time_t     _EXFUN(time,     (time_t *_timer));
69
#ifndef _REENT_ONLY
70
char      *_EXFUN(asctime,  (const struct tm *_tblock));
71
char      *_EXFUN(ctime,    (const time_t *_time));
72
struct tm *_EXFUN(gmtime,   (const time_t *_timer));
73
struct tm *_EXFUN(localtime,(const time_t *_timer));
74
#endif
75
size_t     _EXFUN(strftime, (char *_s, size_t _maxsize, const char *_fmt, const struct tm *_t));
76
 
77
char      *_EXFUN(asctime_r,    (const struct tm *, char *));
78
char      *_EXFUN(ctime_r,      (const time_t *, char *));
79
struct tm *_EXFUN(gmtime_r,     (const time_t *, struct tm *));
80
struct tm *_EXFUN(localtime_r,  (const time_t *, struct tm *));
81
 
82
#ifndef __STRICT_ANSI__
83
char      *_EXFUN(strptime,     (const char *, const char *, struct tm *));
84
_VOID      _EXFUN(tzset,        (_VOID));
85
_VOID      _EXFUN(_tzset_r,     (struct _reent *));
86
 
87
typedef struct __tzrule_struct
88
{
89
  char ch;
90
  int m;
91
  int n;
92
  int d;
93
  int s;
94
  time_t change;
95
  long offset; /* Match type of _timezone. */
96
} __tzrule_type;
97
 
98
typedef struct __tzinfo_struct
99
{
100
  int __tznorth;
101
  int __tzyear;
102
  __tzrule_type __tzrule[2];
103
} __tzinfo_type;
104
 
105
__tzinfo_type *_EXFUN (__gettzinfo, (_VOID));
106
 
107
/* getdate functions */
108
 
109
#ifndef _REENT_ONLY
110
#define getdate_err (*__getdate_err())
111
int *_EXFUN(__getdate_err,(_VOID));
112
 
113
struct tm *     _EXFUN(getdate, (const char *));
114
/* getdate_err is set to one of the following values to indicate the error.
115
     1  the DATEMSK environment variable is null or undefined,
116
     2  the template file cannot be opened for reading,
117
     3  failed to get file status information,
118
     4  the template file is not a regular file,
119
     5  an error is encountered while reading the template file,
120
     6  memory allication failed (not enough memory available),
121
     7  there is no line in the template that matches the input,
122
     8  invalid input specification  */
123
#endif /* !_REENT_ONLY */
124
 
125
/* getdate_r returns the error code as above */
126
int             _EXFUN(getdate_r, (const char *, struct tm *));
127
 
128
/* defines for the opengroup specifications Derived from Issue 1 of the SVID.  */
129
extern __IMPORT long _timezone;
130
extern __IMPORT int _daylight;
131
extern __IMPORT char *_tzname[2];
132
 
133
/* POSIX defines the external tzname being defined in time.h */
134
#ifndef tzname
135
#define tzname _tzname
136
#endif
137
 
138
#endif /* !__STRICT_ANSI__ */
139
 
140
#include <sys/features.h>
141
 
142
#if defined(_POSIX_TIMERS)
143
 
144
#include <signal.h>
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
#endif /* _POSIX_TIMERS */
174
 
175
/* CPU-time Clock Attributes, P1003.4b/D8, p. 54 */
176
 
177
/* values for the clock enable attribute */
178
 
179
#define CLOCK_ENABLED  1  /* clock is enabled, i.e. counting execution time */
180
#define CLOCK_DISABLED 0  /* clock is disabled */
181
 
182
/* values for the pthread cputime_clock_allowed attribute */
183
 
184
#define CLOCK_ALLOWED    1 /* If a thread is created with this value a */
185
                           /*   CPU-time clock attached to that thread */
186
                           /*   shall be accessible. */
187
#define CLOCK_DISALLOWED 0 /* If a thread is created with this value, the */
188
                           /*   thread shall not have a CPU-time clock */
189
                           /*   accessible. */
190
 
191
/* Manifest Constants, P1003.1b-1993, p. 262 */
192
 
193
#define CLOCK_REALTIME (clockid_t)1
194
 
195
/* Flag indicating time is "absolute" with respect to the clock
196
   associated with a time.  */
197
 
198
#define TIMER_ABSTIME  4
199
 
200
/* Manifest Constants, P1003.4b/D8, p. 55 */
201
 
202
#if defined(_POSIX_CPUTIME)
203
 
204
/* When used in a clock or timer function call, this is interpreted as
205
   the identifier of the CPU_time clock associated with the PROCESS
206
   making the function call.  */
207
 
208
#define CLOCK_PROCESS_CPUTIME_ID (clockid_t)2
209
 
210
#endif
211
 
212
#if defined(_POSIX_THREAD_CPUTIME)
213
 
214
/*  When used in a clock or timer function call, this is interpreted as
215
    the identifier of the CPU_time clock associated with the THREAD
216
    making the function call.  */
217
 
218
#define CLOCK_THREAD_CPUTIME_ID (clockid_t)3
219
 
220
#endif
221
 
222
#if defined(_POSIX_CPUTIME)
223
 
224
/* Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55 */
225
 
226
int _EXFUN(clock_getcpuclockid, (pid_t pid, clockid_t *clock_id));
227
 
228
#endif /* _POSIX_CPUTIME */
229
 
230
#if defined(_POSIX_CPUTIME) || defined(_POSIX_THREAD_CPUTIME)
231
 
232
/* CPU-time Clock Attribute Access, P1003.4b/D8, p. 56 */
233
 
234
int _EXFUN(clock_setenable_attr, (clockid_t clock_id, int attr));
235
int _EXFUN(clock_getenable_attr, (clockid_t clock_id, int *attr));
236
 
237
#endif /* _POSIX_CPUTIME or _POSIX_THREAD_CPUTIME */
238
 
239
#ifdef __cplusplus
240
}
241
#endif
242
 
243
#endif /* ! __need_timespec */
244
 
245
#undef __need_timespec
246
 
247
#endif /* _TIME_H_ */
248
 

powered by: WebSVN 2.1.0

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