source: trunk/src/emx/include/time.h@ 1506

Last change on this file since 1506 was 1506, checked in by bird, 21 years ago

@unixroot. header reviews. ++

  • Property cvs2svn:cvs-rev set to 1.6
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 6.9 KB
Line 
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 */
84typedef __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 */
90typedef __time_t time_t;
91#define _TIME_T_DECLARED
92#define _TIME_T /* bird: EMX */
93#endif
94
95#if !defined(_SIZE_T_DECLARED) && !defined(_SIZE_T) /* bird: EMX */
96typedef __size_t size_t;
97#define _SIZE_T_DECLARED
98#define _SIZE_T /* bird: EMX */
99#endif
100
101#if __POSIX_VISIBLE >= 199309
102/*
103 * New in POSIX 1003.1b-1993.
104 */
105#if !defined(_CLOCKID_T_DECLARED) && !defined(_CLOCKID_T) /* bird: EMX */
106typedef __clockid_t clockid_t;
107#define _CLOCKID_T_DECLARED
108#define _CLOCKID_T /* bird: EMX */
109#endif
110
111#if !defined(_TIMER_T_DECLARED) && !defined(_TIMER_T) /* bird: EMX */
112typedef __timer_t timer_t;
113#define _TIMER_T_DECLARED
114#define _TIMER_T /* bird: EMX */
115#endif
116
117#include <sys/timespec.h>
118#endif /* __POSIX_VISIBLE >= 199309 */
119
120struct tm {
121 int tm_sec; /* seconds after the minute [0-60] */
122 int tm_min; /* minutes after the hour [0-59] */
123 int tm_hour; /* hours since midnight [0-23] */
124 int tm_mday; /* day of the month [1-31] */
125 int tm_mon; /* months since January [0-11] */
126 int tm_year; /* years since 1900 */
127 int tm_wday; /* days since Sunday [0-6] */
128 int tm_yday; /* days since January 1 [0-365] */
129 int tm_isdst; /* Daylight Savings Time flag */
130#if 0 /* bird: LIBC isn't implementing tm_gmtoff and tm_zone. */
131 long tm_gmtoff; /* offset from UTC in seconds */
132 char *tm_zone; /* timezone abbreviation */
133#endif
134};
135
136#if __POSIX_VISIBLE
137extern char *tzname[];
138#endif
139
140__BEGIN_DECLS
141char *asctime(const struct tm *);
142clock_t clock(void);
143char *ctime(const time_t *);
144double difftime(time_t, time_t);
145struct tm *gmtime(const time_t *);
146struct tm *localtime(const time_t *);
147time_t mktime(struct tm *);
148size_t strftime(char * __restrict, size_t, const char * __restrict,
149 const struct tm * __restrict);
150time_t time(time_t *);
151
152#if __POSIX_VISIBLE
153void tzset(void);
154#endif
155
156#if __POSIX_VISIBLE >= 199309
157int clock_getres(clockid_t, struct timespec *);
158int clock_gettime(clockid_t, struct timespec *);
159int clock_settime(clockid_t, const struct timespec *);
160int nanosleep(const struct timespec *, struct timespec *);
161#endif /* __POSIX_VISIBLE >= 199309 */
162
163#if __POSIX_VISIBLE >= 199506
164char *asctime_r(const struct tm *, char *);
165char *ctime_r(const time_t *, char *);
166struct tm *gmtime_r(const time_t *, struct tm *);
167struct tm *localtime_r(const time_t *, struct tm *);
168#endif
169
170#if __XSI_VISIBLE
171char *strptime(const char * __restrict, const char * __restrict,
172 struct tm * __restrict);
173#endif
174
175#if __BSD_VISIBLE
176/* bird: clash with EMX (and OGBSI6) timezone is a variable. man page say this
177 * is for Unix version 7 compatability though...
178char *timezone(int, int); */
179void tzsetwall(void);
180time_t timelocal(struct tm * const);
181time_t timegm(struct tm * const);
182#endif /* __BSD_VISIBLE */
183
184/* bird: LIBC OGBSI6 compliance extras. */
185#if __POSIX_VISIBLE
186extern int daylight;
187extern long timezone;
188#endif
189
190/* bird: EMX/VAC/MSC legacy start. */
191#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) || defined (_WITH_UNDERSCORE) || defined(__USE_EMX)
192extern int _daylight;
193extern long _timezone;
194extern char *_tzname[2];
195char *_strptime (__const__ char *, __const__ char *, struct tm *);
196void _tzset (void);
197#endif
198/* bird: EMX stuff end. */
199
200__END_DECLS
201
202#endif /* !_TIME_H_ */
203
Note: See TracBrowser for help on using the repository browser.