xref: /netbsd-src/lib/libc/compat/include/time.h (revision ace5b9b5feb0e7608bd2da7a617428d2e1cf8aa3)
1*ace5b9b5Schristos /*	$NetBSD: time.h,v 1.5 2024/01/20 14:52:46 christos Exp $	*/
25b84b398Schristos 
35b84b398Schristos /*
45b84b398Schristos  * Copyright (c) 1989, 1993
55b84b398Schristos  *	The Regents of the University of California.  All rights reserved.
65b84b398Schristos  * (c) UNIX System Laboratories, Inc.
75b84b398Schristos  * All or some portions of this file are derived from material licensed
85b84b398Schristos  * to the University of California by American Telephone and Telegraph
95b84b398Schristos  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
105b84b398Schristos  * the permission of UNIX System Laboratories, Inc.
115b84b398Schristos  *
125b84b398Schristos  * Redistribution and use in source and binary forms, with or without
135b84b398Schristos  * modification, are permitted provided that the following conditions
145b84b398Schristos  * are met:
155b84b398Schristos  * 1. Redistributions of source code must retain the above copyright
165b84b398Schristos  *    notice, this list of conditions and the following disclaimer.
175b84b398Schristos  * 2. Redistributions in binary form must reproduce the above copyright
185b84b398Schristos  *    notice, this list of conditions and the following disclaimer in the
195b84b398Schristos  *    documentation and/or other materials provided with the distribution.
205b84b398Schristos  * 3. Neither the name of the University nor the names of its contributors
215b84b398Schristos  *    may be used to endorse or promote products derived from this software
225b84b398Schristos  *    without specific prior written permission.
235b84b398Schristos  *
245b84b398Schristos  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
255b84b398Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
265b84b398Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
275b84b398Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
285b84b398Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
295b84b398Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
305b84b398Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
315b84b398Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
325b84b398Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
335b84b398Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
345b84b398Schristos  * SUCH DAMAGE.
355b84b398Schristos  *
365b84b398Schristos  *	@(#)time.h	8.3 (Berkeley) 1/21/94
375b84b398Schristos  */
385b84b398Schristos 
395b84b398Schristos #ifndef _COMPAT_TIME_H_
405b84b398Schristos #define	_COMPAT_TIME_H_
415b84b398Schristos 
42461a86f9Schristos #include <compat/sys/time.h>
435b84b398Schristos #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
445b84b398Schristos     defined(_NETBSD_SOURCE)
455b84b398Schristos #define CLK_TCK 100
465b84b398Schristos #endif
475b84b398Schristos 
485b84b398Schristos __BEGIN_DECLS
495b84b398Schristos #if (_XOPEN_SOURCE - 0) >= 4 || defined(_NETBSD_SOURCE)
505b84b398Schristos char *strptime(const char * __restrict, const char * __restrict,
515b84b398Schristos     struct tm * __restrict);
52*ace5b9b5Schristos #ifdef __TIMEZONE_FUNCTION__
535b84b398Schristos char *timezone(int, int);
54*ace5b9b5Schristos char *_tztab(int, int);
55*ace5b9b5Schristos #else
56*ace5b9b5Schristos extern int	daylight;
57*ace5b9b5Schristos extern long	timezone __RENAME(__timezone13);
58461a86f9Schristos #endif
595b84b398Schristos 
605b84b398Schristos #endif /* !_ANSI_SOURCE */
61461a86f9Schristos char *ctime(const int32_t *);
62461a86f9Schristos double difftime(int32_t, int32_t);
63461a86f9Schristos struct tm *gmtime(const int32_t *);
64461a86f9Schristos struct tm *localtime(const int32_t *);
65461a86f9Schristos int32_t time(int32_t *);
66461a86f9Schristos int32_t mktime(struct tm *);
67461a86f9Schristos void tzset(void);
68461a86f9Schristos void tzsetwall(void);
69461a86f9Schristos void __tzset50(void);
70461a86f9Schristos void __tzsetwall50(void);
715b84b398Schristos 
72461a86f9Schristos int clock_getres(clockid_t, struct timespec50 *);
73461a86f9Schristos int clock_gettime(clockid_t, struct timespec50 *);
74461a86f9Schristos int clock_settime(clockid_t, const struct timespec50 *);
75461a86f9Schristos int __clock_getres50(clockid_t, struct timespec *);
76461a86f9Schristos int __clock_gettime50(clockid_t, struct timespec *);
77461a86f9Schristos int __clock_settime50(clockid_t, const struct timespec *);
78461a86f9Schristos int nanosleep(const struct timespec50 *, struct timespec50 *);
79461a86f9Schristos int __nanosleep50(const struct timespec *, struct timespec *);
80461a86f9Schristos int timer_gettime(timer_t, struct itimerspec50 *);
81461a86f9Schristos int timer_settime(timer_t, int, const struct itimerspec50 * __restrict,
82461a86f9Schristos     struct itimerspec50 * __restrict);
83461a86f9Schristos int __timer_gettime50(timer_t, struct itimerspec *);
84461a86f9Schristos int __timer_settime50(timer_t, int, const struct itimerspec * __restrict,
85461a86f9Schristos     struct itimerspec * __restrict);
86461a86f9Schristos int __timer_getres50(timer_t, struct itimerspec *);
87461a86f9Schristos char *ctime_r(const int32_t *, char *);
88461a86f9Schristos struct tm *gmtime_r(const int32_t * __restrict, struct tm * __restrict);
89461a86f9Schristos struct tm *localtime_r(const int32_t * __restrict, struct tm * __restrict);
90461a86f9Schristos struct tm *offtime(const int32_t *, long);
915a87b22eSchristos struct tm *offtime_r(const int32_t *, long, struct tm *);
92461a86f9Schristos int32_t timelocal(struct tm *);
93461a86f9Schristos int32_t timegm(struct tm *);
94461a86f9Schristos int32_t timeoff(struct tm *, long);
95461a86f9Schristos int32_t time2posix(int32_t);
96461a86f9Schristos int32_t posix2time(int32_t);
975a87b22eSchristos struct tm *localtime_rz(const timezone_t, const int32_t * __restrict,
985a87b22eSchristos     struct tm * __restrict);
995a87b22eSchristos char *ctime_rz(const timezone_t, const int32_t *, char *);
1005a87b22eSchristos int32_t mktime_z(const timezone_t, struct tm *);
1015a87b22eSchristos int32_t timelocal_z(const timezone_t, struct tm *);
1025a87b22eSchristos int32_t time2posix_z(const timezone_t, int32_t);
1035a87b22eSchristos int32_t posix2time_z(const timezone_t, int32_t);
1045a87b22eSchristos timezone_t tzalloc(const char *);
1055a87b22eSchristos void tzfree(const timezone_t);
1065a87b22eSchristos const char *tzgetname(const timezone_t, int);
107f4d28d09Schristos long tzgetgmtoff(const timezone_t, int);
1085a87b22eSchristos 
1095b84b398Schristos #endif /* !_COMPAT_TIME_H_ */
110