[BACK]Return to time.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / include

Annotation of src/include/time.h, Revision 1.29

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

CVSweb <webmaster@jp.NetBSD.org>