time.h revision 25769
11539Srgrimes/*
21539Srgrimes * Copyright (c) 1989, 1993
31539Srgrimes *	The Regents of the University of California.  All rights reserved.
41539Srgrimes * (c) UNIX System Laboratories, Inc.
51539Srgrimes * All or some portions of this file are derived from material licensed
61539Srgrimes * to the University of California by American Telephone and Telegraph
71539Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with
81539Srgrimes * the permission of UNIX System Laboratories, Inc.
91539Srgrimes *
101539Srgrimes * Redistribution and use in source and binary forms, with or without
111539Srgrimes * modification, are permitted provided that the following conditions
121539Srgrimes * are met:
131539Srgrimes * 1. Redistributions of source code must retain the above copyright
141539Srgrimes *    notice, this list of conditions and the following disclaimer.
151539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
161539Srgrimes *    notice, this list of conditions and the following disclaimer in the
171539Srgrimes *    documentation and/or other materials provided with the distribution.
181539Srgrimes * 3. All advertising materials mentioning features or use of this software
191539Srgrimes *    must display the following acknowledgement:
201539Srgrimes *	This product includes software developed by the University of
211539Srgrimes *	California, Berkeley and its contributors.
221539Srgrimes * 4. Neither the name of the University nor the names of its contributors
231539Srgrimes *    may be used to endorse or promote products derived from this software
241539Srgrimes *    without specific prior written permission.
251539Srgrimes *
261539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
271539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
281539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
291539Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
301539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
311539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
321539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
331539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
341539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
351539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
361539Srgrimes * SUCH DAMAGE.
371539Srgrimes *
381539Srgrimes *	@(#)time.h	8.3 (Berkeley) 1/21/94
391539Srgrimes */
401539Srgrimes
411539Srgrimes#ifndef _TIME_H_
421539Srgrimes#define	_TIME_H_
431539Srgrimes
441539Srgrimes#include <machine/ansi.h>
451539Srgrimes
466164Sbde#ifndef _ANSI_SOURCE
476164Sbde/*
486164Sbde * Frequency of the clock ticks reported by times().  Deprecated - use
496164Sbde * sysconf(_SC_CLK_TCK) instead.
506164Sbde */
516243Sbde#define	CLK_TCK		_BSD_CLK_TCK_
526164Sbde#endif
536164Sbde
546164Sbde/* Frequency of the clock ticks reported by clock().  */
556164Sbde#define	CLOCKS_PER_SEC	_BSD_CLOCKS_PER_SEC_
566164Sbde
571539Srgrimes#ifndef	NULL
581539Srgrimes#define	NULL	0
591539Srgrimes#endif
601539Srgrimes
611539Srgrimes#ifdef	_BSD_CLOCK_T_
621539Srgrimestypedef	_BSD_CLOCK_T_	clock_t;
631539Srgrimes#undef	_BSD_CLOCK_T_
641539Srgrimes#endif
651539Srgrimes
661539Srgrimes#ifdef	_BSD_TIME_T_
671539Srgrimestypedef	_BSD_TIME_T_	time_t;
681539Srgrimes#undef	_BSD_TIME_T_
691539Srgrimes#endif
701539Srgrimes
7125769Sache#ifdef	_BSD_CLOCKID_T_
7225769Sachetypedef	_BSD_CLOCKID_T_	clockid_t;
7325769Sache#undef	_BSD_CLOCKID_T_
7425769Sache#endif
7525769Sache
761539Srgrimes#ifdef	_BSD_SIZE_T_
771539Srgrimestypedef	_BSD_SIZE_T_	size_t;
781539Srgrimes#undef	_BSD_SIZE_T_
791539Srgrimes#endif
801539Srgrimes
811539Srgrimesstruct tm {
821539Srgrimes	int	tm_sec;		/* seconds after the minute [0-60] */
831539Srgrimes	int	tm_min;		/* minutes after the hour [0-59] */
841539Srgrimes	int	tm_hour;	/* hours since midnight [0-23] */
851539Srgrimes	int	tm_mday;	/* day of the month [1-31] */
861539Srgrimes	int	tm_mon;		/* months since January [0-11] */
871539Srgrimes	int	tm_year;	/* years since 1900 */
881539Srgrimes	int	tm_wday;	/* days since Sunday [0-6] */
891539Srgrimes	int	tm_yday;	/* days since January 1 [0-365] */
901539Srgrimes	int	tm_isdst;	/* Daylight Savings Time flag */
911539Srgrimes	long	tm_gmtoff;	/* offset from CUT in seconds */
921539Srgrimes	char	*tm_zone;	/* timezone abbreviation */
931539Srgrimes};
941539Srgrimes
951539Srgrimes#include <sys/cdefs.h>
961539Srgrimes
971539Srgrimes__BEGIN_DECLS
981539Srgrimeschar *asctime __P((const struct tm *));
991539Srgrimesclock_t clock __P((void));
10025749Speterint clock_getres __P((clockid_t, struct timespec *));
10125749Speterint clock_gettime __P((clockid_t, struct timespec *));
10225749Speterint clock_settime __P((clockid_t, const struct timespec *));
1031539Srgrimeschar *ctime __P((const time_t *));
1041539Srgrimesdouble difftime __P((time_t, time_t));
1051539Srgrimesstruct tm *gmtime __P((const time_t *));
1061539Srgrimesstruct tm *localtime __P((const time_t *));
1071539Srgrimestime_t mktime __P((struct tm *));
10825749Speterint nanosleep __P((const struct timespec *, struct timespec *));
1091539Srgrimessize_t strftime __P((char *, size_t, const char *, const struct tm *));
1101539Srgrimestime_t time __P((time_t *));
1111539Srgrimes
11213545Sjulian#ifdef	_THREAD_SAFE
11313545Sjulianint asctime_r __P((const struct tm *, char *, int));
11419639Shsuint ctime_r __P((const time_t *, char *, int));
11519639Shsustruct tm *gmtime_r __P((const time_t *, struct tm *));
11619639Shsustruct tm *localtime_r __P((const time_t *, struct tm *));
11713545Sjulian#endif
11813545Sjulian
1191539Srgrimes#ifndef _ANSI_SOURCE
1201539Srgrimesvoid tzset __P((void));
1211539Srgrimes#endif /* not ANSI */
1221539Srgrimes
1231539Srgrimes#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
1241539Srgrimeschar *timezone __P((int, int));
1251539Srgrimesvoid tzsetwall __P((void));
1265231Sachetime_t timelocal __P((struct tm * const));
1275231Sachetime_t timegm __P((struct tm * const));
1281539Srgrimes#endif /* neither ANSI nor POSIX */
1291539Srgrimes__END_DECLS
1301539Srgrimes
1311539Srgrimes#endif /* !_TIME_H_ */
132