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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [include/] [time.h] - Blame information for rev 1005

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1005 ivang
/*
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
 
12
#ifdef __cplusplus
13
extern "C" {
14
#endif
15
 
16
#ifndef NULL
17
#define NULL    0
18
#endif
19
 
20
/* Get _CLOCKS_PER_SEC_ */
21
#include <machine/time.h>
22
 
23
#ifndef _CLOCKS_PER_SEC_
24
#define _CLOCKS_PER_SEC_ 1000
25
#endif
26
 
27
#define CLOCKS_PER_SEC _CLOCKS_PER_SEC_
28
#define CLK_TCK CLOCKS_PER_SEC
29
#define __need_size_t
30
#include <stddef.h>
31
 
32
#include <sys/types.h>
33
 
34
struct tm
35
{
36
  int   tm_sec;
37
  int   tm_min;
38
  int   tm_hour;
39
  int   tm_mday;
40
  int   tm_mon;
41
  int   tm_year;
42
  int   tm_wday;
43
  int   tm_yday;
44
  int   tm_isdst;
45
};
46
 
47
clock_t    _EXFUN(clock,    (void));
48
double     _EXFUN(difftime, (time_t _time2, time_t _time1));
49
time_t     _EXFUN(mktime,   (struct tm *_timeptr));
50
time_t     _EXFUN(time,     (time_t *_timer));
51
#ifndef _REENT_ONLY
52
char      *_EXFUN(asctime,  (const struct tm *_tblock));
53
char      *_EXFUN(ctime,    (const time_t *_time));
54
struct tm *_EXFUN(gmtime,   (const time_t *_timer));
55
struct tm *_EXFUN(localtime,(const time_t *_timer));
56
#endif
57
size_t     _EXFUN(strftime, (char *_s, size_t _maxsize, const char *_fmt, const struct tm *_t));
58
 
59
char      *_EXFUN(asctime_r,    (const struct tm *, char *));
60
char      *_EXFUN(ctime_r,      (const time_t *, char *));
61
struct tm *_EXFUN(gmtime_r,     (const time_t *, struct tm *));
62
struct tm *_EXFUN(localtime_r,  (const time_t *, struct tm *));
63
 
64
#ifdef __CYGWIN__
65
#ifndef __STRICT_ANSI__
66
extern __IMPORT time_t _timezone;
67
extern __IMPORT int _daylight;
68
extern __IMPORT char *_tzname[2];
69
/* defines for the opengroup specifications Derived from Issue 1 of the SVID.  */
70
#ifndef tzname
71
#define tzname _tzname
72
#endif
73
#ifndef daylight
74
#define daylight _daylight
75
#endif
76
#if timezonevar
77
#ifndef timezone
78
#define timezone ((long int) _timezone)
79
#endif
80
#else
81
char *_EXFUN(timezone, (void));
82
#endif
83
void _EXFUN(tzset, (void));
84
#endif
85
#endif /* __CYGWIN__ */
86
 
87
#include <sys/features.h>
88
 
89
 
90
#if defined(_POSIX_TIMERS)
91
 
92
#include <signal.h>
93
 
94
/* Clocks, P1003.1b-1993, p. 263 */
95
 
96
int _EXFUN(clock_settime, (clockid_t clock_id, const struct timespec *tp));
97
int _EXFUN(clock_gettime, (clockid_t clock_id, struct timespec *tp));
98
int _EXFUN(clock_getres,  (clockid_t clock_id, struct timespec *res));
99
 
100
/* Create a Per-Process Timer, P1003.1b-1993, p. 264 */
101
 
102
int _EXFUN(timer_create,
103
  (clockid_t clock_id, struct sigevent *evp, timer_t *timerid));
104
 
105
/* Delete a Per_process Timer, P1003.1b-1993, p. 266 */
106
 
107
int _EXFUN(timer_delete, (timer_t timerid));
108
 
109
/* Per-Process Timers, P1003.1b-1993, p. 267 */
110
 
111
int _EXFUN(timer_settime,
112
  (timer_t timerid, int flags, const struct itimerspec *value,
113
   struct itimerspec *ovalue));
114
int _EXFUN(timer_gettime, (timer_t timerid, struct itimerspec *value));
115
int _EXFUN(timer_getoverrun, (timer_t timerid));
116
 
117
/* High Resolution Sleep, P1003.1b-1993, p. 269 */
118
 
119
int _EXFUN(nanosleep, (const struct timespec  *rqtp, struct timespec *rmtp));
120
 
121
#endif /* _POSIX_TIMERS */
122
 
123
/* CPU-time Clock Attributes, P1003.4b/D8, p. 54 */
124
 
125
/* values for the clock enable attribute */
126
 
127
#define CLOCK_ENABLED  1  /* clock is enabled, i.e. counting execution time */
128
#define CLOCK_DISABLED 0  /* clock is disabled */
129
 
130
/* values for the pthread cputime_clock_allowed attribute */
131
 
132
#define CLOCK_ALLOWED    1 /* If a thread is created with this value a */
133
                           /*   CPU-time clock attached to that thread */
134
                           /*   shall be accessible. */
135
#define CLOCK_DISALLOWED 0 /* If a thread is created with this value, the */
136
                           /*   thread shall not have a CPU-time clock */
137
                           /*   accessible. */
138
 
139
/* Manifest Constants, P1003.1b-1993, p. 262 */
140
 
141
#define CLOCK_REALTIME (clockid_t)1
142
 
143
/* Flag indicating time is "absolute" with respect to the clock
144
   associated with a time.  */
145
 
146
#define TIMER_ABSTIME  4
147
 
148
/* Manifest Constants, P1003.4b/D8, p. 55 */
149
 
150
#if defined(_POSIX_CPUTIME)
151
 
152
/* When used in a clock or timer function call, this is interpreted as
153
   the identifier of the CPU_time clock associated with the PROCESS
154
   making the function call.  */
155
 
156
#define CLOCK_PROCESS_CPUTIME (clockid_t)2
157
 
158
#endif
159
 
160
#if defined(_POSIX_THREAD_CPUTIME)
161
 
162
/*  When used in a clock or timer function call, this is interpreted as
163
    the identifier of the CPU_time clock associated with the THREAD
164
    making the function call.  */
165
 
166
#define CLOCK_THREAD_CPUTIME (clockid_t)3
167
 
168
#endif
169
 
170
#if defined(_POSIX_CPUTIME)
171
 
172
/* Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55 */
173
 
174
int _EXFUN(clock_getcpuclockid, (pid_t pid, clockid_t *clock_id));
175
 
176
#endif /* _POSIX_CPUTIME */
177
 
178
#if defined(_POSIX_CPUTIME) || defined(_POSIX_THREAD_CPUTIME)
179
 
180
/* CPU-time Clock Attribute Access, P1003.4b/D8, p. 56 */
181
 
182
int _EXFUN(clock_setenable_attr, (clockid_t clock_id, int attr));
183
int _EXFUN(clock_getenable_attr, (clockid_t clock_id, int *attr));
184
 
185
#endif /* _POSIX_CPUTIME or _POSIX_THREAD_CPUTIME */
186
 
187
#ifdef __cplusplus
188
}
189
#endif
190
#endif /* _TIME_H_ */
191
 

powered by: WebSVN 2.1.0

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