1 | /** @file
|
---|
2 | * FreeBSD 5.1
|
---|
3 | *
|
---|
4 | * @changed EMX isms.
|
---|
5 | * @changed Removed timezone() function as it clashes with the timezone
|
---|
6 | * variable defined in EMX and OGBSI6.
|
---|
7 | * @changed Changed CLK_TCK and CLOCKS_PER_SEC to 100.
|
---|
8 | * @changed Commented out tm_gmtoff and tm_zone in struct tm as LIBC doesn't
|
---|
9 | * implement these yet.
|
---|
10 | *
|
---|
11 | * @todo Implement tm_gmtoff and tm_zone members in struct tm.
|
---|
12 | * @todo Implement clock_getres(), clock_gettime(), clock_settime() which
|
---|
13 | * are defined in various POSIX standard revisions.
|
---|
14 | * @todo Implement tzsetwall(), timelocal(), timegm() which are BSD specific.
|
---|
15 | */
|
---|
16 | /*
|
---|
17 | * Copyright (c) 1989, 1993
|
---|
18 | * The Regents of the University of California. All rights reserved.
|
---|
19 | * (c) UNIX System Laboratories, Inc.
|
---|
20 | * All or some portions of this file are derived from material licensed
|
---|
21 | * to the University of California by American Telephone and Telegraph
|
---|
22 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
---|
23 | * the permission of UNIX System Laboratories, Inc.
|
---|
24 | *
|
---|
25 | * Redistribution and use in source and binary forms, with or without
|
---|
26 | * modification, are permitted provided that the following conditions
|
---|
27 | * are met:
|
---|
28 | * 1. Redistributions of source code must retain the above copyright
|
---|
29 | * notice, this list of conditions and the following disclaimer.
|
---|
30 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
31 | * notice, this list of conditions and the following disclaimer in the
|
---|
32 | * documentation and/or other materials provided with the distribution.
|
---|
33 | * 3. All advertising materials mentioning features or use of this software
|
---|
34 | * must display the following acknowledgement:
|
---|
35 | * This product includes software developed by the University of
|
---|
36 | * California, Berkeley and its contributors.
|
---|
37 | * 4. Neither the name of the University nor the names of its contributors
|
---|
38 | * may be used to endorse or promote products derived from this software
|
---|
39 | * without specific prior written permission.
|
---|
40 | *
|
---|
41 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
---|
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
---|
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
---|
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
---|
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
---|
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
---|
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
51 | * SUCH DAMAGE.
|
---|
52 | *
|
---|
53 | * @(#)time.h 8.3 (Berkeley) 1/21/94
|
---|
54 | */
|
---|
55 |
|
---|
56 | /*
|
---|
57 | * $FreeBSD: src/include/time.h,v 1.30 2002/09/06 11:23:32 tjr Exp $
|
---|
58 | */
|
---|
59 |
|
---|
60 | #ifndef _TIME_H_
|
---|
61 | #define _TIME_H_
|
---|
62 | #define _TIME_H /* bird: EMX */
|
---|
63 |
|
---|
64 | #include <sys/cdefs.h>
|
---|
65 | #include <sys/_types.h>
|
---|
66 |
|
---|
67 | #if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
|
---|
68 | /*
|
---|
69 | * Frequency of the clock ticks reported by times(). Deprecated - use
|
---|
70 | * sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.)
|
---|
71 | */
|
---|
72 | #define CLK_TCK 100 /* bird: EMX uses 100, FreeBSD 128. */
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | /* Frequency of the clock ticks reported by clock(). */
|
---|
76 | #define CLOCKS_PER_SEC 100 /* bird: EMX uses 100, FreeBSD 128. */
|
---|
77 |
|
---|
78 | #ifndef NULL
|
---|
79 | #define NULL 0
|
---|
80 | #endif
|
---|
81 |
|
---|
82 | #if !defined(_CLOCK_T_DECLARED) && !defined(_CLOCK_T) /* bird: EMX */
|
---|
83 | typedef __clock_t clock_t;
|
---|
84 | #define _CLOCK_T_DECLARED
|
---|
85 | #define _CLOCK_T /* bird: EMX */
|
---|
86 | #endif
|
---|
87 |
|
---|
88 | #if !defined(_TIME_T_DECLARED) && !defined(_TIME_T) /* bird: EMX */
|
---|
89 | typedef __time_t time_t;
|
---|
90 | #define _TIME_T_DECLARED
|
---|
91 | #define _TIME_T /* bird: EMX */
|
---|
92 | #endif
|
---|
93 |
|
---|
94 | #ifndef _TIME64_T_DECLARED /* bird: LIBC */
|
---|
95 | typedef __int64_t time64_t; /* bird: LIBC */
|
---|
96 | #define _TIME64_T_DECLARED /* bird: LIBC */
|
---|
97 | #endif /* bird: LIBC */
|
---|
98 |
|
---|
99 | #if !defined(_SIZE_T_DECLARED) && !defined(_SIZE_T) /* bird: EMX */
|
---|
100 | typedef __size_t size_t;
|
---|
101 | #define _SIZE_T_DECLARED
|
---|
102 | #define _SIZE_T /* bird: EMX */
|
---|
103 | #endif
|
---|
104 |
|
---|
105 | #if __POSIX_VISIBLE >= 199309
|
---|
106 | /*
|
---|
107 | * New in POSIX 1003.1b-1993.
|
---|
108 | */
|
---|
109 | #if !defined(_CLOCKID_T_DECLARED) && !defined(_CLOCKID_T) /* bird: EMX */
|
---|
110 | typedef __clockid_t clockid_t;
|
---|
111 | #define _CLOCKID_T_DECLARED
|
---|
112 | #define _CLOCKID_T /* bird: EMX */
|
---|
113 | #endif
|
---|
114 |
|
---|
115 | #if !defined(_TIMER_T_DECLARED) && !defined(_TIMER_T) /* bird: EMX */
|
---|
116 | typedef __timer_t timer_t;
|
---|
117 | #define _TIMER_T_DECLARED
|
---|
118 | #define _TIMER_T /* bird: EMX */
|
---|
119 | #endif
|
---|
120 |
|
---|
121 | #include <sys/timespec.h>
|
---|
122 | #endif /* __POSIX_VISIBLE >= 199309 */
|
---|
123 |
|
---|
124 | struct tm {
|
---|
125 | int tm_sec; /* seconds after the minute [0-60] */
|
---|
126 | int tm_min; /* minutes after the hour [0-59] */
|
---|
127 | int tm_hour; /* hours since midnight [0-23] */
|
---|
128 | int tm_mday; /* day of the month [1-31] */
|
---|
129 | int tm_mon; /* months since January [0-11] */
|
---|
130 | int tm_year; /* years since 1900 */
|
---|
131 | int tm_wday; /* days since Sunday [0-6] */
|
---|
132 | int tm_yday; /* days since January 1 [0-365] */
|
---|
133 | int tm_isdst; /* Daylight Savings Time flag */
|
---|
134 | #if 0 /* bird: LIBC isn't implementing tm_gmtoff and tm_zone. */
|
---|
135 | long tm_gmtoff; /* offset from UTC in seconds */
|
---|
136 | char *tm_zone; /* timezone abbreviation */
|
---|
137 | #endif
|
---|
138 | };
|
---|
139 |
|
---|
140 | #if __POSIX_VISIBLE
|
---|
141 | extern char *tzname[];
|
---|
142 | #endif
|
---|
143 |
|
---|
144 | __BEGIN_DECLS
|
---|
145 | char *asctime(const struct tm *);
|
---|
146 | clock_t clock(void);
|
---|
147 | char *ctime(const time_t *);
|
---|
148 | double difftime(time_t, time_t);
|
---|
149 | struct tm *gmtime(const time_t *);
|
---|
150 | struct tm *localtime(const time_t *);
|
---|
151 | struct tm *_localtime64_r(const time64_t *, struct tm *); /* bird: LIBC */
|
---|
152 | time_t mktime(struct tm *);
|
---|
153 | time64_t _mktime64(struct tm *); /* bird: LIBC */
|
---|
154 | size_t strftime(char * __restrict, size_t, const char * __restrict,
|
---|
155 | const struct tm * __restrict);
|
---|
156 | time_t time(time_t *);
|
---|
157 |
|
---|
158 | #if __POSIX_VISIBLE
|
---|
159 | void tzset(void);
|
---|
160 | #endif
|
---|
161 |
|
---|
162 | #if __POSIX_VISIBLE >= 199309
|
---|
163 | int clock_getres(clockid_t, struct timespec *);
|
---|
164 | int clock_gettime(clockid_t, struct timespec *);
|
---|
165 | int clock_settime(clockid_t, const struct timespec *);
|
---|
166 | int nanosleep(const struct timespec *, struct timespec *);
|
---|
167 | #endif /* __POSIX_VISIBLE >= 199309 */
|
---|
168 |
|
---|
169 | #if __POSIX_VISIBLE >= 199506
|
---|
170 | char *asctime_r(const struct tm *, char *);
|
---|
171 | char *ctime_r(const time_t *, char *);
|
---|
172 | struct tm *gmtime_r(const time_t *, struct tm *);
|
---|
173 | struct tm *_gmtime64_r(const time64_t *, struct tm *); /* bird: LIBC */
|
---|
174 | struct tm *localtime_r(const time_t *, struct tm *);
|
---|
175 | #endif
|
---|
176 |
|
---|
177 | #if __XSI_VISIBLE
|
---|
178 | char *strptime(const char * __restrict, const char * __restrict,
|
---|
179 | struct tm * __restrict);
|
---|
180 | #endif
|
---|
181 |
|
---|
182 | #if __BSD_VISIBLE
|
---|
183 | /* bird: clash with EMX (and OGBSI6) timezone is a variable. man page say this
|
---|
184 | * is for Unix version 7 compatability though...
|
---|
185 | char *timezone(int, int); */
|
---|
186 | void tzsetwall(void);
|
---|
187 | time_t timelocal(struct tm * const);
|
---|
188 | time_t timegm(struct tm * const);
|
---|
189 | #endif /* __BSD_VISIBLE */
|
---|
190 |
|
---|
191 | /* bird: LIBC OGBSI6 compliance extras. */
|
---|
192 | #if __POSIX_VISIBLE
|
---|
193 | extern int daylight;
|
---|
194 | extern long timezone;
|
---|
195 | #endif
|
---|
196 |
|
---|
197 | /* bird: EMX/VAC/MSC legacy start. */
|
---|
198 | #if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) || defined (_WITH_UNDERSCORE) || defined(__USE_EMX)
|
---|
199 | extern int _daylight;
|
---|
200 | extern long _timezone;
|
---|
201 | extern char *_tzname[2];
|
---|
202 | char *_strptime (const char *, const char *, struct tm *);
|
---|
203 | void _tzset (void);
|
---|
204 | #endif
|
---|
205 | /* bird: EMX stuff end. */
|
---|
206 |
|
---|
207 | __END_DECLS
|
---|
208 |
|
---|
209 | #endif /* !_TIME_H_ */
|
---|
210 |
|
---|