xref: /minix3/lib/libc/compat/include/time.h (revision 2fe8fb192fe7e8720e3e7a77f928da545e872a6a)
1*2fe8fb19SBen Gras /*	$NetBSD: time.h,v 1.3 2010/12/16 18:38:06 christos Exp $	*/
2*2fe8fb19SBen Gras 
3*2fe8fb19SBen Gras /*
4*2fe8fb19SBen Gras  * Copyright (c) 1989, 1993
5*2fe8fb19SBen Gras  *	The Regents of the University of California.  All rights reserved.
6*2fe8fb19SBen Gras  * (c) UNIX System Laboratories, Inc.
7*2fe8fb19SBen Gras  * All or some portions of this file are derived from material licensed
8*2fe8fb19SBen Gras  * to the University of California by American Telephone and Telegraph
9*2fe8fb19SBen Gras  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10*2fe8fb19SBen Gras  * the permission of UNIX System Laboratories, Inc.
11*2fe8fb19SBen Gras  *
12*2fe8fb19SBen Gras  * Redistribution and use in source and binary forms, with or without
13*2fe8fb19SBen Gras  * modification, are permitted provided that the following conditions
14*2fe8fb19SBen Gras  * are met:
15*2fe8fb19SBen Gras  * 1. Redistributions of source code must retain the above copyright
16*2fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer.
17*2fe8fb19SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
18*2fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer in the
19*2fe8fb19SBen Gras  *    documentation and/or other materials provided with the distribution.
20*2fe8fb19SBen Gras  * 3. Neither the name of the University nor the names of its contributors
21*2fe8fb19SBen Gras  *    may be used to endorse or promote products derived from this software
22*2fe8fb19SBen Gras  *    without specific prior written permission.
23*2fe8fb19SBen Gras  *
24*2fe8fb19SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25*2fe8fb19SBen Gras  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26*2fe8fb19SBen Gras  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27*2fe8fb19SBen Gras  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28*2fe8fb19SBen Gras  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29*2fe8fb19SBen Gras  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30*2fe8fb19SBen Gras  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31*2fe8fb19SBen Gras  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32*2fe8fb19SBen Gras  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33*2fe8fb19SBen Gras  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34*2fe8fb19SBen Gras  * SUCH DAMAGE.
35*2fe8fb19SBen Gras  *
36*2fe8fb19SBen Gras  *	@(#)time.h	8.3 (Berkeley) 1/21/94
37*2fe8fb19SBen Gras  */
38*2fe8fb19SBen Gras 
39*2fe8fb19SBen Gras #ifndef _COMPAT_TIME_H_
40*2fe8fb19SBen Gras #define	_COMPAT_TIME_H_
41*2fe8fb19SBen Gras 
42*2fe8fb19SBen Gras #include <compat/sys/time.h>
43*2fe8fb19SBen Gras #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
44*2fe8fb19SBen Gras     defined(_NETBSD_SOURCE)
45*2fe8fb19SBen Gras #define CLK_TCK 100
46*2fe8fb19SBen Gras #endif
47*2fe8fb19SBen Gras 
48*2fe8fb19SBen Gras __BEGIN_DECLS
49*2fe8fb19SBen Gras #if (_XOPEN_SOURCE - 0) >= 4 || defined(_NETBSD_SOURCE)
50*2fe8fb19SBen Gras char *strptime(const char * __restrict, const char * __restrict,
51*2fe8fb19SBen Gras     struct tm * __restrict);
52*2fe8fb19SBen Gras #if 0
53*2fe8fb19SBen Gras #if defined(_NETBSD_SOURCE)
54*2fe8fb19SBen Gras char *timezone(int, int);
55*2fe8fb19SBen Gras #endif /* _NETBSD_SOURCE */
56*2fe8fb19SBen Gras #endif
57*2fe8fb19SBen Gras 
58*2fe8fb19SBen Gras #endif /* !_ANSI_SOURCE */
59*2fe8fb19SBen Gras char *ctime(const int32_t *);
60*2fe8fb19SBen Gras double difftime(int32_t, int32_t);
61*2fe8fb19SBen Gras struct tm *gmtime(const int32_t *);
62*2fe8fb19SBen Gras struct tm *localtime(const int32_t *);
63*2fe8fb19SBen Gras int32_t time(int32_t *);
64*2fe8fb19SBen Gras int32_t mktime(struct tm *);
65*2fe8fb19SBen Gras void tzset(void);
66*2fe8fb19SBen Gras void tzsetwall(void);
67*2fe8fb19SBen Gras void __tzset50(void);
68*2fe8fb19SBen Gras void __tzsetwall50(void);
69*2fe8fb19SBen Gras 
70*2fe8fb19SBen Gras int clock_getres(clockid_t, struct timespec50 *);
71*2fe8fb19SBen Gras int clock_gettime(clockid_t, struct timespec50 *);
72*2fe8fb19SBen Gras int clock_settime(clockid_t, const struct timespec50 *);
73*2fe8fb19SBen Gras int __clock_getres50(clockid_t, struct timespec *);
74*2fe8fb19SBen Gras int __clock_gettime50(clockid_t, struct timespec *);
75*2fe8fb19SBen Gras int __clock_settime50(clockid_t, const struct timespec *);
76*2fe8fb19SBen Gras int nanosleep(const struct timespec50 *, struct timespec50 *);
77*2fe8fb19SBen Gras int __nanosleep50(const struct timespec *, struct timespec *);
78*2fe8fb19SBen Gras int timer_gettime(timer_t, struct itimerspec50 *);
79*2fe8fb19SBen Gras int timer_settime(timer_t, int, const struct itimerspec50 * __restrict,
80*2fe8fb19SBen Gras     struct itimerspec50 * __restrict);
81*2fe8fb19SBen Gras int __timer_gettime50(timer_t, struct itimerspec *);
82*2fe8fb19SBen Gras int __timer_settime50(timer_t, int, const struct itimerspec * __restrict,
83*2fe8fb19SBen Gras     struct itimerspec * __restrict);
84*2fe8fb19SBen Gras int __timer_getres50(timer_t, struct itimerspec *);
85*2fe8fb19SBen Gras char *ctime_r(const int32_t *, char *);
86*2fe8fb19SBen Gras struct tm *gmtime_r(const int32_t * __restrict, struct tm * __restrict);
87*2fe8fb19SBen Gras struct tm *localtime_r(const int32_t * __restrict, struct tm * __restrict);
88*2fe8fb19SBen Gras struct tm *offtime(const int32_t *, long);
89*2fe8fb19SBen Gras struct tm *offtime_r(const int32_t *, long, struct tm *);
90*2fe8fb19SBen Gras int32_t timelocal(struct tm *);
91*2fe8fb19SBen Gras int32_t timegm(struct tm *);
92*2fe8fb19SBen Gras int32_t timeoff(struct tm *, long);
93*2fe8fb19SBen Gras int32_t time2posix(int32_t);
94*2fe8fb19SBen Gras int32_t posix2time(int32_t);
95*2fe8fb19SBen Gras struct tm *localtime_rz(const timezone_t, const int32_t * __restrict,
96*2fe8fb19SBen Gras     struct tm * __restrict);
97*2fe8fb19SBen Gras char *ctime_rz(const timezone_t, const int32_t *, char *);
98*2fe8fb19SBen Gras int32_t mktime_z(const timezone_t, struct tm *);
99*2fe8fb19SBen Gras int32_t timelocal_z(const timezone_t, struct tm *);
100*2fe8fb19SBen Gras int32_t time2posix_z(const timezone_t, int32_t);
101*2fe8fb19SBen Gras int32_t posix2time_z(const timezone_t, int32_t);
102*2fe8fb19SBen Gras timezone_t tzalloc(const char *);
103*2fe8fb19SBen Gras void tzfree(const timezone_t);
104*2fe8fb19SBen Gras const char *tzgetname(const timezone_t, int);
105*2fe8fb19SBen Gras 
106*2fe8fb19SBen Gras #endif /* !_COMPAT_TIME_H_ */
107