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