Home | History | Annotate | Line # | Download | only in include
time.h revision 1.21
      1  1.21    kleink /*	$NetBSD: time.h,v 1.21 1998/09/10 18:37:28 kleink Exp $	*/
      2   1.9       cgd 
      3   1.7       cgd /*
      4  1.15     perry  * Copyright (c) 1989, 1993
      5  1.15     perry  *	The Regents of the University of California.  All rights reserved.
      6   1.7       cgd  * (c) UNIX System Laboratories, Inc.
      7   1.7       cgd  * All or some portions of this file are derived from material licensed
      8   1.7       cgd  * to the University of California by American Telephone and Telegraph
      9   1.7       cgd  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
     10   1.7       cgd  * the permission of UNIX System Laboratories, Inc.
     11   1.7       cgd  *
     12   1.7       cgd  * Redistribution and use in source and binary forms, with or without
     13   1.7       cgd  * modification, are permitted provided that the following conditions
     14   1.7       cgd  * are met:
     15   1.7       cgd  * 1. Redistributions of source code must retain the above copyright
     16   1.7       cgd  *    notice, this list of conditions and the following disclaimer.
     17   1.7       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     18   1.7       cgd  *    notice, this list of conditions and the following disclaimer in the
     19   1.7       cgd  *    documentation and/or other materials provided with the distribution.
     20   1.7       cgd  * 3. All advertising materials mentioning features or use of this software
     21   1.7       cgd  *    must display the following acknowledgement:
     22   1.7       cgd  *	This product includes software developed by the University of
     23   1.7       cgd  *	California, Berkeley and its contributors.
     24   1.7       cgd  * 4. Neither the name of the University nor the names of its contributors
     25   1.7       cgd  *    may be used to endorse or promote products derived from this software
     26   1.7       cgd  *    without specific prior written permission.
     27   1.7       cgd  *
     28   1.7       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     29   1.7       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     30   1.7       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     31   1.7       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     32   1.7       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     33   1.7       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     34   1.7       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     35   1.7       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     36   1.7       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     37   1.7       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     38   1.7       cgd  * SUCH DAMAGE.
     39   1.7       cgd  *
     40  1.15     perry  *	@(#)time.h	8.3 (Berkeley) 1/21/94
     41   1.7       cgd  */
     42   1.7       cgd 
     43   1.7       cgd #ifndef _TIME_H_
     44   1.7       cgd #define	_TIME_H_
     45   1.7       cgd 
     46  1.19   mycroft #include <sys/cdefs.h>
     47  1.21    kleink #include <sys/featuretest.h>
     48   1.7       cgd #include <machine/ansi.h>
     49  1.20   mycroft #include <machine/limits.h>	/* Include file containing CLK_TCK. */
     50   1.7       cgd 
     51   1.7       cgd #ifndef	NULL
     52   1.7       cgd #define	NULL	0
     53   1.7       cgd #endif
     54   1.7       cgd 
     55   1.8       cgd #ifdef	_BSD_CLOCK_T_
     56   1.8       cgd typedef	_BSD_CLOCK_T_	clock_t;
     57   1.8       cgd #undef	_BSD_CLOCK_T_
     58   1.7       cgd #endif
     59   1.7       cgd 
     60   1.8       cgd #ifdef	_BSD_TIME_T_
     61   1.8       cgd typedef	_BSD_TIME_T_	time_t;
     62   1.8       cgd #undef	_BSD_TIME_T_
     63   1.7       cgd #endif
     64   1.7       cgd 
     65   1.8       cgd #ifdef	_BSD_SIZE_T_
     66   1.8       cgd typedef	_BSD_SIZE_T_	size_t;
     67   1.8       cgd #undef	_BSD_SIZE_T_
     68  1.12  christos #endif
     69  1.12  christos 
     70  1.12  christos #ifdef	_BSD_CLOCKID_T_
     71  1.12  christos typedef	_BSD_CLOCKID_T_	clockid_t;
     72  1.12  christos #undef	_BSD_CLOCKID_T_
     73  1.12  christos #endif
     74  1.12  christos 
     75  1.12  christos #ifdef	_BSD_TIMER_T_
     76  1.12  christos typedef	_BSD_TIMER_T_	timer_t;
     77  1.12  christos #undef	_BSD_TIMER_T_
     78   1.7       cgd #endif
     79   1.7       cgd 
     80   1.7       cgd #define CLOCKS_PER_SEC	100
     81   1.7       cgd 
     82   1.7       cgd struct tm {
     83  1.14    kleink 	int	tm_sec;		/* seconds after the minute [0-61] */
     84   1.7       cgd 	int	tm_min;		/* minutes after the hour [0-59] */
     85   1.7       cgd 	int	tm_hour;	/* hours since midnight [0-23] */
     86   1.7       cgd 	int	tm_mday;	/* day of the month [1-31] */
     87   1.7       cgd 	int	tm_mon;		/* months since January [0-11] */
     88   1.7       cgd 	int	tm_year;	/* years since 1900 */
     89   1.7       cgd 	int	tm_wday;	/* days since Sunday [0-6] */
     90   1.7       cgd 	int	tm_yday;	/* days since January 1 [0-365] */
     91   1.7       cgd 	int	tm_isdst;	/* Daylight Savings Time flag */
     92   1.7       cgd 	long	tm_gmtoff;	/* offset from CUT in seconds */
     93  1.18   mycroft 	__aconst char *tm_zone;	/* timezone abbreviation */
     94   1.7       cgd };
     95   1.7       cgd 
     96   1.7       cgd __BEGIN_DECLS
     97   1.7       cgd char *asctime __P((const struct tm *));
     98   1.7       cgd clock_t clock __P((void));
     99   1.7       cgd char *ctime __P((const time_t *));
    100   1.7       cgd double difftime __P((time_t, time_t));
    101   1.7       cgd struct tm *gmtime __P((const time_t *));
    102   1.7       cgd struct tm *localtime __P((const time_t *));
    103   1.7       cgd time_t mktime __P((struct tm *));
    104   1.7       cgd size_t strftime __P((char *, size_t, const char *, const struct tm *));
    105   1.7       cgd time_t time __P((time_t *));
    106   1.7       cgd 
    107   1.7       cgd #if !defined(_ANSI_SOURCE)
    108   1.7       cgd #define CLK_TCK		100
    109  1.18   mycroft extern __aconst char *tzname[2];
    110   1.7       cgd void tzset __P((void));
    111   1.7       cgd 
    112  1.21    kleink /*
    113  1.21    kleink  * X/Open Portability Guide >= Issue 4
    114  1.21    kleink  */
    115  1.21    kleink #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
    116  1.21    kleink     (_XOPEN_SOURCE - 0) >= 4
    117  1.10    kleink char *strptime __P((const char *, const char *, struct tm *));
    118  1.21    kleink #endif
    119  1.11  christos 
    120  1.21    kleink #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
    121  1.21    kleink     (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500
    122  1.21    kleink #include <sys/time.h>		/* XXX for struct timespec */
    123  1.11  christos struct sigevent;
    124  1.11  christos struct itimerspec;
    125  1.14    kleink int clock_getres __P((clockid_t, struct timespec *));
    126  1.14    kleink int clock_gettime __P((clockid_t, struct timespec *));
    127  1.14    kleink int clock_settime __P((clockid_t, const struct timespec *));
    128  1.13    kleink int nanosleep __P((const struct timespec *, struct timespec *));
    129  1.11  christos int timer_create __P((clockid_t, struct sigevent *, timer_t *));
    130  1.11  christos int timer_delete __P((timer_t));
    131  1.11  christos int timer_getoverrun __P((timer_t));
    132  1.11  christos int timer_gettime __P((timer_t, struct itimerspec *));
    133  1.11  christos int timer_settime __P((timer_t, int, const struct itimerspec *,
    134  1.11  christos     struct itimerspec *));
    135  1.21    kleink #endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || ... */
    136  1.21    kleink 
    137  1.21    kleink #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
    138  1.21    kleink     (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
    139  1.21    kleink     defined(_REENTRANT)
    140  1.21    kleink char *asctime_r __P((const struct tm *, char *));
    141  1.21    kleink char *ctime_r __P((const time_t *, char *));
    142  1.21    kleink struct tm *gmtime_r __P((const time_t *, struct tm *));
    143  1.21    kleink struct tm *localtime_r __P((const time_t *, struct tm *));
    144  1.13    kleink #endif
    145  1.21    kleink 
    146  1.21    kleink #if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
    147  1.21    kleink time_t time2posix __P((time_t));
    148  1.21    kleink time_t posix2time __P((time_t));
    149  1.21    kleink time_t timegm __P((struct tm *const));
    150  1.21    kleink time_t timeoff __P((struct tm *const, const long));
    151  1.21    kleink long gtime __P((struct tm *const));
    152  1.21    kleink time_t timelocal __P((struct tm *const));
    153  1.21    kleink char *timezone __P((int, int));
    154  1.21    kleink void tzsetwall __P((void));
    155  1.21    kleink struct tm *offtime __P((const time_t *const, const long));
    156  1.21    kleink #endif /* !_POSIX_C_SOURCE && !_XOPEN_SOURCE */
    157  1.21    kleink 
    158  1.21    kleink #endif /* !_ANSI_SOURCE */
    159   1.7       cgd __END_DECLS
    160   1.7       cgd 
    161   1.7       cgd #endif /* !_TIME_H_ */
    162