time.h revision 28021
1263508Sdim/*
2249259Sdim * Copyright (c) 1989, 1993
3249259Sdim *	The Regents of the University of California.  All rights reserved.
4249259Sdim * (c) UNIX System Laboratories, Inc.
5249259Sdim * All or some portions of this file are derived from material licensed
6249259Sdim * to the University of California by American Telephone and Telegraph
7249259Sdim * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8249259Sdim * the permission of UNIX System Laboratories, Inc.
9249259Sdim *
10249259Sdim * Redistribution and use in source and binary forms, with or without
11249259Sdim * modification, are permitted provided that the following conditions
12249259Sdim * are met:
13249259Sdim * 1. Redistributions of source code must retain the above copyright
14249259Sdim *    notice, this list of conditions and the following disclaimer.
15249259Sdim * 2. Redistributions in binary form must reproduce the above copyright
16249259Sdim *    notice, this list of conditions and the following disclaimer in the
17249259Sdim *    documentation and/or other materials provided with the distribution.
18249259Sdim * 3. All advertising materials mentioning features or use of this software
19249259Sdim *    must display the following acknowledgement:
20249259Sdim *	This product includes software developed by the University of
21249259Sdim *	California, Berkeley and its contributors.
22249259Sdim * 4. Neither the name of the University nor the names of its contributors
23249259Sdim *    may be used to endorse or promote products derived from this software
24249259Sdim *    without specific prior written permission.
25249259Sdim *
26249259Sdim * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27249259Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28249259Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29249259Sdim * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30249259Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31249259Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32249259Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33249259Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34249259Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35249259Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36249259Sdim * SUCH DAMAGE.
37249259Sdim *
38249259Sdim *	@(#)time.h	8.3 (Berkeley) 1/21/94
39249259Sdim */
40249259Sdim
41249259Sdim#ifndef _TIME_H_
42249259Sdim#define	_TIME_H_
43249259Sdim
44249259Sdim#include <machine/ansi.h>
45249259Sdim
46249259Sdim#ifndef _ANSI_SOURCE
47249259Sdim/*
48249259Sdim * Frequency of the clock ticks reported by times().  Deprecated - use
49249259Sdim * sysconf(_SC_CLK_TCK) instead.
50249259Sdim */
51249259Sdim#define	CLK_TCK		_BSD_CLK_TCK_
52249259Sdim#endif
53249259Sdim
54249259Sdim/* Frequency of the clock ticks reported by clock().  */
55249259Sdim#define	CLOCKS_PER_SEC	_BSD_CLOCKS_PER_SEC_
56249259Sdim
57249259Sdim#ifndef	NULL
58249259Sdim#define	NULL	0
59249259Sdim#endif
60249259Sdim
61249259Sdim#ifdef	_BSD_CLOCK_T_
62249259Sdimtypedef	_BSD_CLOCK_T_	clock_t;
63249259Sdim#undef	_BSD_CLOCK_T_
64249259Sdim#endif
65249259Sdim
66249259Sdim#ifdef	_BSD_TIME_T_
67249259Sdimtypedef	_BSD_TIME_T_	time_t;
68249259Sdim#undef	_BSD_TIME_T_
69249259Sdim#endif
70249259Sdim
71249259Sdim#ifdef	_BSD_SIZE_T_
72249259Sdimtypedef	_BSD_SIZE_T_	size_t;
73249259Sdim#undef	_BSD_SIZE_T_
74249259Sdim#endif
75249259Sdim
76249259Sdim#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
77249259Sdim/*
78249259Sdim * New in POSIX 1003.1b-1993.
79249259Sdim */
80249259Sdim#ifdef	_BSD_CLOCKID_T_
81249259Sdimtypedef	_BSD_CLOCKID_T_	clockid_t;
82249259Sdim#undef	_BSD_CLOCKID_T_
83249259Sdim#endif
84249259Sdim
85249259Sdim#ifdef	_BSD_TIMER_T_
86249259Sdimtypedef	_BSD_TIMER_T_	timer_t;
87249259Sdim#undef	_BSD_TIMER_T_
88249259Sdim#endif
89249259Sdim
90249259Sdim#ifndef _TIMESPEC_DECLARED
91249259Sdim#define _TIMESPEC_DECLARED
92249259Sdimstruct timespec {
93249259Sdim	time_t	tv_sec;		/* seconds */
94249259Sdim	long	tv_nsec;	/* and nanoseconds */
95249259Sdim};
96249259Sdim#endif
97249259Sdim#endif /* Neither ANSI nor POSIX */
98249259Sdim
99249259Sdimstruct tm {
100249259Sdim	int	tm_sec;		/* seconds after the minute [0-60] */
101249259Sdim	int	tm_min;		/* minutes after the hour [0-59] */
102249259Sdim	int	tm_hour;	/* hours since midnight [0-23] */
103249259Sdim	int	tm_mday;	/* day of the month [1-31] */
104249259Sdim	int	tm_mon;		/* months since January [0-11] */
105249259Sdim	int	tm_year;	/* years since 1900 */
106249259Sdim	int	tm_wday;	/* days since Sunday [0-6] */
107249259Sdim	int	tm_yday;	/* days since January 1 [0-365] */
108249259Sdim	int	tm_isdst;	/* Daylight Savings Time flag */
109249259Sdim	long	tm_gmtoff;	/* offset from CUT in seconds */
110249259Sdim	char	*tm_zone;	/* timezone abbreviation */
111249259Sdim};
112249259Sdim
113249259Sdim#include <sys/cdefs.h>
114249259Sdim
115263508Sdim__BEGIN_DECLS
116263508Sdimchar *asctime __P((const struct tm *));
117249259Sdimclock_t clock __P((void));
118249259Sdimchar *ctime __P((const time_t *));
119249259Sdimdouble difftime __P((time_t, time_t));
120249259Sdimstruct tm *gmtime __P((const time_t *));
121249259Sdimstruct tm *localtime __P((const time_t *));
122249259Sdimtime_t mktime __P((struct tm *));
123249259Sdimsize_t strftime __P((char *, size_t, const char *, const struct tm *));
124249259Sdimtime_t time __P((time_t *));
125249259Sdim
126249259Sdim#ifdef	_THREAD_SAFE
127249259Sdimint asctime_r __P((const struct tm *, char *, int));
128249259Sdimint ctime_r __P((const time_t *, char *, int));
129249259Sdimstruct tm *gmtime_r __P((const time_t *, struct tm *));
130249259Sdimstruct tm *localtime_r __P((const time_t *, struct tm *));
131249259Sdim#endif
132249259Sdim
133249259Sdim#ifndef _ANSI_SOURCE
134249259Sdimvoid tzset __P((void));
135249259Sdim#endif /* not ANSI */
136249259Sdim
137249259Sdim#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
138249259Sdimconst char *strptime __P((const char *, const char *, struct tm *));
139249259Sdimchar *timezone __P((int, int));
140249259Sdimvoid tzsetwall __P((void));
141249259Sdimtime_t timelocal __P((struct tm * const));
142249259Sdimtime_t timegm __P((struct tm * const));
143249259Sdim
144249259Sdim/* Introduced in POSIX 1003.1b-1993, not part of 1003.1-1990. */
145249259Sdimint clock_getres __P((clockid_t, struct timespec *));
146249259Sdimint clock_gettime __P((clockid_t, struct timespec *));
147249259Sdimint clock_settime __P((clockid_t, const struct timespec *));
148249259Sdimint nanosleep __P((const struct timespec *, struct timespec *));
149249259Sdim#endif /* neither ANSI nor POSIX */
150249259Sdim__END_DECLS
151249259Sdim
152249259Sdim#endif /* !_TIME_H_ */
153249259Sdim