4 * Struct and function declarations for dealing with time.
20 /* Get _CLOCKS_PER_SEC_ */
21 #include <machine/time.h>
23 #ifndef _CLOCKS_PER_SEC_
24 #define _CLOCKS_PER_SEC_ 1000
27 #define CLOCKS_PER_SEC _CLOCKS_PER_SEC_
28 #define CLK_TCK CLOCKS_PER_SEC
32 #include <sys/types.h>
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
));
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
));
57 size_t _EXFUN(strftime
, (char *_s
, size_t _maxsize
, const char *_fmt
, const struct tm
*_t
));
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
*));
64 #if defined(__CYGWIN__) || defined(__MSYS__)
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. */
71 #define tzname _tzname
74 #define daylight _daylight
78 #define timezone ((long int) _timezone)
81 char *_EXFUN(timezone
, (void));
83 void _EXFUN(tzset
, (void));
85 #endif /* __CYGWIN__ or __MSYS__ */
87 #include <sys/features.h>
90 #if defined(_POSIX_TIMERS)
94 /* Clocks, P1003.1b-1993, p. 263 */
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
));
100 /* Create a Per-Process Timer, P1003.1b-1993, p. 264 */
102 int _EXFUN(timer_create
,
103 (clockid_t clock_id
, struct sigevent
*evp
, timer_t
*timerid
));
105 /* Delete a Per_process Timer, P1003.1b-1993, p. 266 */
107 int _EXFUN(timer_delete
, (timer_t timerid
));
109 /* Per-Process Timers, P1003.1b-1993, p. 267 */
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
));
117 /* High Resolution Sleep, P1003.1b-1993, p. 269 */
119 int _EXFUN(nanosleep
, (const struct timespec
*rqtp
, struct timespec
*rmtp
));
121 #endif /* _POSIX_TIMERS */
123 /* CPU-time Clock Attributes, P1003.4b/D8, p. 54 */
125 /* values for the clock enable attribute */
127 #define CLOCK_ENABLED 1 /* clock is enabled, i.e. counting execution time */
128 #define CLOCK_DISABLED 0 /* clock is disabled */
130 /* values for the pthread cputime_clock_allowed attribute */
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 */
139 /* Manifest Constants, P1003.1b-1993, p. 262 */
141 #define CLOCK_REALTIME (clockid_t)1
143 /* Flag indicating time is "absolute" with respect to the clock
144 associated with a time. */
146 #define TIMER_ABSTIME 4
148 /* Manifest Constants, P1003.4b/D8, p. 55 */
150 #if defined(_POSIX_CPUTIME)
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. */
156 #define CLOCK_PROCESS_CPUTIME (clockid_t)2
160 #if defined(_POSIX_THREAD_CPUTIME)
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. */
166 #define CLOCK_THREAD_CPUTIME (clockid_t)3
170 #if defined(_POSIX_CPUTIME)
172 /* Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55 */
174 int _EXFUN(clock_getcpuclockid
, (pid_t pid
, clockid_t
*clock_id
));
176 #endif /* _POSIX_CPUTIME */
178 #if defined(_POSIX_CPUTIME) || defined(_POSIX_THREAD_CPUTIME)
180 /* CPU-time Clock Attribute Access, P1003.4b/D8, p. 56 */
182 int _EXFUN(clock_setenable_attr
, (clockid_t clock_id
, int attr
));
183 int _EXFUN(clock_getenable_attr
, (clockid_t clock_id
, int *attr
));
185 #endif /* _POSIX_CPUTIME or _POSIX_THREAD_CPUTIME */
190 #endif /* _TIME_H_ */