time.h revision 38464
1184588Sdfr/* 2184588Sdfr * Copyright (c) 1989, 1993 3184588Sdfr * The Regents of the University of California. All rights reserved. 4184588Sdfr * (c) UNIX System Laboratories, Inc. 5184588Sdfr * All or some portions of this file are derived from material licensed 6184588Sdfr * to the University of California by American Telephone and Telegraph 7184588Sdfr * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8184588Sdfr * the permission of UNIX System Laboratories, Inc. 9184588Sdfr * 10184588Sdfr * Redistribution and use in source and binary forms, with or without 11184588Sdfr * modification, are permitted provided that the following conditions 12184588Sdfr * are met: 13184588Sdfr * 1. Redistributions of source code must retain the above copyright 14184588Sdfr * notice, this list of conditions and the following disclaimer. 15184588Sdfr * 2. Redistributions in binary form must reproduce the above copyright 16184588Sdfr * notice, this list of conditions and the following disclaimer in the 17184588Sdfr * documentation and/or other materials provided with the distribution. 18184588Sdfr * 3. All advertising materials mentioning features or use of this software 19184588Sdfr * must display the following acknowledgement: 20184588Sdfr * This product includes software developed by the University of 21184588Sdfr * California, Berkeley and its contributors. 22184588Sdfr * 4. Neither the name of the University nor the names of its contributors 23184588Sdfr * may be used to endorse or promote products derived from this software 24184588Sdfr * without specific prior written permission. 25184588Sdfr * 26184588Sdfr * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27184588Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28184588Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29184588Sdfr * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30184588Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31184588Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32184588Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33184588Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34184588Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35184588Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36184588Sdfr * SUCH DAMAGE. 37184588Sdfr * 38184588Sdfr * @(#)time.h 8.3 (Berkeley) 1/21/94 39184588Sdfr */ 40184588Sdfr 41184588Sdfr#ifndef _TIME_H_ 42184588Sdfr#define _TIME_H_ 43184588Sdfr 44184588Sdfr#include <machine/ansi.h> 45184588Sdfr#include <sys/_posix.h> 46184588Sdfr 47184588Sdfr#ifndef _ANSI_SOURCE 48184588Sdfr/* 49184588Sdfr * Frequency of the clock ticks reported by times(). Deprecated - use 50184588Sdfr * sysconf(_SC_CLK_TCK) instead. 51184588Sdfr */ 52184588Sdfr#define CLK_TCK _BSD_CLK_TCK_ 53184588Sdfr#endif 54184588Sdfr 55184588Sdfr/* Frequency of the clock ticks reported by clock(). */ 56184588Sdfr#define CLOCKS_PER_SEC _BSD_CLOCKS_PER_SEC_ 57184588Sdfr 58184588Sdfr#ifndef NULL 59184588Sdfr#define NULL 0 60184588Sdfr#endif 61184588Sdfr 62184588Sdfr#ifdef _BSD_CLOCK_T_ 63184588Sdfrtypedef _BSD_CLOCK_T_ clock_t; 64184588Sdfr#undef _BSD_CLOCK_T_ 65184588Sdfr#endif 66184588Sdfr 67184588Sdfr#ifdef _BSD_TIME_T_ 68184588Sdfrtypedef _BSD_TIME_T_ time_t; 69184588Sdfr#undef _BSD_TIME_T_ 70184588Sdfr#endif 71184588Sdfr 72184588Sdfr#ifdef _BSD_SIZE_T_ 73184588Sdfrtypedef _BSD_SIZE_T_ size_t; 74184588Sdfr#undef _BSD_SIZE_T_ 75184588Sdfr#endif 76184588Sdfr 77184588Sdfr/* XXX I'm not sure if _ANSI_SOURCE is playing properly 78184588Sdfr * with the setups in _posix.h: 79184588Sdfr */ 80184588Sdfr#if !defined(_ANSI_SOURCE) && defined(_P1003_1B_VISIBLE_HISTORICALLY) 81184588Sdfr/* 82184588Sdfr * New in POSIX 1003.1b-1993. 83184588Sdfr */ 84184588Sdfr#ifdef _BSD_CLOCKID_T_ 85184588Sdfrtypedef _BSD_CLOCKID_T_ clockid_t; 86184588Sdfr#undef _BSD_CLOCKID_T_ 87184588Sdfr#endif 88184588Sdfr 89184588Sdfr#ifdef _BSD_TIMER_T_ 90184588Sdfrtypedef _BSD_TIMER_T_ timer_t; 91184588Sdfr#undef _BSD_TIMER_T_ 92184588Sdfr#endif 93184588Sdfr 94184588Sdfr#ifndef _TIMESPEC_DECLARED 95184588Sdfr#define _TIMESPEC_DECLARED 96184588Sdfrstruct timespec { 97184588Sdfr time_t tv_sec; /* seconds */ 98184588Sdfr long tv_nsec; /* and nanoseconds */ 99184588Sdfr}; 100184588Sdfr#endif 101184588Sdfr#endif /* Neither ANSI nor POSIX */ 102184588Sdfr 103184588Sdfrstruct tm { 104299617Sngie int tm_sec; /* seconds after the minute [0-60] */ 105299617Sngie int tm_min; /* minutes after the hour [0-59] */ 106184588Sdfr int tm_hour; /* hours since midnight [0-23] */ 107299617Sngie int tm_mday; /* day of the month [1-31] */ 108184588Sdfr int tm_mon; /* months since January [0-11] */ 109184588Sdfr int tm_year; /* years since 1900 */ 110184588Sdfr int tm_wday; /* days since Sunday [0-6] */ 111184588Sdfr int tm_yday; /* days since January 1 [0-365] */ 112184588Sdfr int tm_isdst; /* Daylight Savings Time flag */ 113184588Sdfr long tm_gmtoff; /* offset from CUT in seconds */ 114184588Sdfr char *tm_zone; /* timezone abbreviation */ 115184588Sdfr}; 116184588Sdfr 117184588Sdfr#include <sys/cdefs.h> 118184588Sdfr 119184588Sdfr#ifndef _ANSI_SOURCE 120184588Sdfrextern char *tzname[]; 121184588Sdfr#endif 122184588Sdfr 123184588Sdfr__BEGIN_DECLS 124184588Sdfrchar *asctime __P((const struct tm *)); 125184588Sdfrclock_t clock __P((void)); 126184588Sdfrchar *ctime __P((const time_t *)); 127184588Sdfrdouble difftime __P((time_t, time_t)); 128184588Sdfrstruct tm *gmtime __P((const time_t *)); 129184588Sdfrstruct tm *localtime __P((const time_t *)); 130184588Sdfrtime_t mktime __P((struct tm *)); 131184588Sdfrsize_t strftime __P((char *, size_t, const char *, const struct tm *)); 132184588Sdfrtime_t time __P((time_t *)); 133184588Sdfr 134184588Sdfr#ifdef _THREAD_SAFE 135184588Sdfrchar *asctime_r __P((const struct tm *, char *)); 136184588Sdfrchar *ctime_r __P((const time_t *, char *)); 137184588Sdfrstruct tm *gmtime_r __P((const time_t *, struct tm *)); 138184588Sdfrstruct tm *localtime_r __P((const time_t *, struct tm *)); 139184588Sdfr#endif 140184588Sdfr 141184588Sdfr#ifndef _ANSI_SOURCE 142184588Sdfrvoid tzset __P((void)); 143184588Sdfr#endif /* not ANSI */ 144184588Sdfr 145184588Sdfr#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 146184588Sdfrconst char *strptime __P((const char *, const char *, struct tm *)); 147184588Sdfrchar *timezone __P((int, int)); 148184588Sdfrvoid tzsetwall __P((void)); 149184588Sdfrtime_t timelocal __P((struct tm * const)); 150184588Sdfrtime_t timegm __P((struct tm * const)); 151184588Sdfr#endif /* neither ANSI nor POSIX */ 152184588Sdfr 153184588Sdfr#if !defined(_ANSI_SOURCE) && defined(_P1003_1B_VISIBLE_HISTORICALLY) 154184588Sdfr/* Introduced in POSIX 1003.1b-1993, not part of 1003.1-1990. */ 155184588Sdfrint clock_getres __P((clockid_t, struct timespec *)); 156184588Sdfrint clock_gettime __P((clockid_t, struct timespec *)); 157184588Sdfrint clock_settime __P((clockid_t, const struct timespec *)); 158184588Sdfrint nanosleep __P((const struct timespec *, struct timespec *)); 159184588Sdfr#endif /* neither ANSI nor POSIX */ 160184588Sdfr__END_DECLS 161184588Sdfr 162184588Sdfr#endif /* !_TIME_H_ */ 163184588Sdfr