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

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

1.30    ! schwarze    1: /*     $OpenBSD: time.h,v 1.29 2016/09/09 18:12:37 millert Exp $       */
1.1       deraadt     2: /*     $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $     */
                      3:
                      4: /*
                      5:  * Copyright (c) 1989 The Regents of the University of California.
                      6:  * All rights reserved.
                      7:  *
                      8:  * (c) UNIX System Laboratories, Inc.
                      9:  * All or some portions of this file are derived from material licensed
                     10:  * to the University of California by American Telephone and Telegraph
                     11:  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
                     12:  * the permission of UNIX System Laboratories, Inc.
                     13:  *
                     14:  * Redistribution and use in source and binary forms, with or without
                     15:  * modification, are permitted provided that the following conditions
                     16:  * are met:
                     17:  * 1. Redistributions of source code must retain the above copyright
                     18:  *    notice, this list of conditions and the following disclaimer.
                     19:  * 2. Redistributions in binary form must reproduce the above copyright
                     20:  *    notice, this list of conditions and the following disclaimer in the
                     21:  *    documentation and/or other materials provided with the distribution.
1.13      millert    22:  * 3. Neither the name of the University nor the names of its contributors
1.1       deraadt    23:  *    may be used to endorse or promote products derived from this software
                     24:  *    without specific prior written permission.
                     25:  *
                     26:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     27:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     28:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     29:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     30:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     31:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     32:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     33:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     34:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     35:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     36:  * SUCH DAMAGE.
                     37:  *
                     38:  *     @(#)time.h      5.12 (Berkeley) 3/9/91
                     39:  */
                     40:
                     41: #ifndef _TIME_H_
                     42: #define        _TIME_H_
                     43:
1.17      millert    44: #include <sys/cdefs.h>
1.29      millert    45: #include <sys/_null.h>
1.24      guenther   46: #include <sys/_types.h>
1.1       deraadt    47:
1.18      millert    48: #ifndef        _CLOCK_T_DEFINED_
                     49: #define        _CLOCK_T_DEFINED_
                     50: typedef        __clock_t       clock_t;
1.1       deraadt    51: #endif
                     52:
1.18      millert    53: #ifndef        _TIME_T_DEFINED_
                     54: #define        _TIME_T_DEFINED_
                     55: typedef        __time_t        time_t;
1.1       deraadt    56: #endif
                     57:
1.18      millert    58: #ifndef        _SIZE_T_DEFINED_
                     59: #define        _SIZE_T_DEFINED_
                     60: typedef        __size_t        size_t;
1.1       deraadt    61: #endif
                     62:
1.17      millert    63: #if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
                     64: /*
                     65:  * Frequency of the clock ticks reported by times().  Deprecated - use
                     66:  * sysconf(_SC_CLK_TCK) instead.  (Removed in 1003.1-2001.)
                     67:  */
                     68: #define CLK_TCK                100
                     69: #endif
                     70:
                     71: #define CLOCKS_PER_SEC 100     /* frequency of ticks reported by clock().  */
                     72:
1.22      kettenis   73: #if __POSIX_VISIBLE >= 199309
1.17      millert    74: #ifndef _TIMESPEC_DECLARED
                     75: #define _TIMESPEC_DECLARED
                     76: struct timespec {
                     77:        time_t  tv_sec;         /* seconds */
                     78:        long    tv_nsec;        /* and nanoseconds */
                     79: };
                     80: #endif
1.1       deraadt    81:
1.21      kettenis   82: #include <sys/_time.h>
                     83:
                     84: #ifndef        _CLOCKID_T_DEFINED_
                     85: #define        _CLOCKID_T_DEFINED_
                     86: typedef        __clockid_t     clockid_t;
                     87: #endif
                     88:
                     89: #ifndef        _TIMER_T_DEFINED_
                     90: #define        _TIMER_T_DEFINED_
                     91: typedef        __timer_t       timer_t;
                     92: #endif
                     93: #endif
                     94:
1.25      guenther   95: #if __POSIX_VISIBLE >= 200112
                     96: #ifndef        _PID_T_DEFINED_
                     97: #define        _PID_T_DEFINED_
                     98: typedef        __pid_t         pid_t;
                     99: #endif
                    100: #endif
                    101:
1.30    ! schwarze  102: #if __POSIX_VISIBLE >= 200809
        !           103: #ifndef        _LOCALE_T_DEFINED_
        !           104: #define        _LOCALE_T_DEFINED_
        !           105: typedef void   *locale_t;
        !           106: #endif
        !           107: #endif
        !           108:
1.1       deraadt   109: struct tm {
                    110:        int     tm_sec;         /* seconds after the minute [0-60] */
                    111:        int     tm_min;         /* minutes after the hour [0-59] */
                    112:        int     tm_hour;        /* hours since midnight [0-23] */
                    113:        int     tm_mday;        /* day of the month [1-31] */
                    114:        int     tm_mon;         /* months since January [0-11] */
                    115:        int     tm_year;        /* years since 1900 */
                    116:        int     tm_wday;        /* days since Sunday [0-6] */
                    117:        int     tm_yday;        /* days since January 1 [0-365] */
1.5       pjanzen   118:        int     tm_isdst;       /* Daylight Saving Time flag */
1.6       aaron     119:        long    tm_gmtoff;      /* offset from UTC in seconds */
1.1       deraadt   120:        char    *tm_zone;       /* timezone abbreviation */
                    121: };
                    122:
                    123: __BEGIN_DECLS
1.11      millert   124: char *asctime(const struct tm *);
                    125: clock_t clock(void);
                    126: char *ctime(const time_t *);
                    127: double difftime(time_t, time_t);
                    128: struct tm *gmtime(const time_t *);
                    129: struct tm *localtime(const time_t *);
                    130: time_t mktime(struct tm *);
1.23      guenther  131: size_t strftime(char *__restrict, size_t, const char *__restrict,
                    132:                const struct tm *__restrict)
1.16      avsm      133:                __attribute__ ((__bounded__(__string__,1,2)));
1.22      kettenis  134: time_t time(time_t *);
                    135:
1.28      millert   136: #if __XPG_VISIBLE >= 300
                    137: extern int daylight;
                    138: extern long timezone;
                    139: #endif
1.22      kettenis  140: #if __XPG_VISIBLE >= 400
1.23      guenther  141: char *strptime(const char *__restrict, const char *__restrict,
                    142:                struct tm *__restrict);
1.22      kettenis  143: #endif
                    144:
                    145: #if __POSIX_VISIBLE >= 199506
1.23      guenther  146: char *asctime_r(const struct tm *__restrict, char *__restrict)
1.16      avsm      147:                __attribute__ ((__bounded__(__minbytes__,2,26)));
                    148: char *ctime_r(const time_t *, char *)
                    149:                __attribute__ ((__bounded__(__minbytes__,2,26)));
1.23      guenther  150: struct tm *gmtime_r(const time_t *__restrict, struct tm *__restrict);
                    151: struct tm *localtime_r(const time_t *__restrict, struct tm *__restrict);
1.22      kettenis  152: #endif
1.1       deraadt   153:
1.17      millert   154: #if __POSIX_VISIBLE
1.1       deraadt   155: extern char *tzname[2];
1.11      millert   156: void tzset(void);
1.21      kettenis  157: #endif
                    158:
1.22      kettenis  159: #if __POSIX_VISIBLE >= 199309
1.21      kettenis  160: int clock_getres(clockid_t, struct timespec *);
                    161: int clock_gettime(clockid_t, struct timespec *);
                    162: int clock_settime(clockid_t, const struct timespec *);
1.22      kettenis  163: int nanosleep(const struct timespec *, struct timespec *);
1.25      guenther  164: #endif
                    165:
                    166: #if __POSIX_VISIBLE >= 200112
                    167: int clock_getcpuclockid(pid_t, clockid_t *);
1.30    ! schwarze  168: #endif
        !           169:
        !           170: #if __POSIX_VISIBLE >= 200809
        !           171: size_t strftime_l(char *__restrict, size_t, const char *__restrict,
        !           172:                const struct tm *__restrict, locale_t)
        !           173:                __attribute__ ((__bounded__(__string__,1,2)));
1.17      millert   174: #endif
1.1       deraadt   175:
1.17      millert   176: #if __BSD_VISIBLE
1.11      millert   177: void tzsetwall(void);
                    178: time_t timelocal(struct tm *);
                    179: time_t timegm(struct tm *);
                    180: time_t timeoff(struct tm *, const long);
1.17      millert   181: #endif
1.1       deraadt   182: __END_DECLS
                    183:
                    184: #endif /* !_TIME_H_ */