1 /**	$MirOS: src/include/time.h,v 1.12 2014/02/09 16:15:32 tg Exp $ */
2 /*	$OpenBSD: time.h,v 1.16 2003/08/01 17:38:33 avsm Exp $	*/
3 /*	$NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $	*/
4 
5 /*
6  * Copyright © 2013, 2014
7  *	Thorsten “mirabilos” Glaser <tg@mirbsd.org>
8  * Copyright (c) 1989 The Regents of the University of California.
9  * All rights reserved.
10  *
11  * (c) UNIX System Laboratories, Inc.
12  * All or some portions of this file are derived from material licensed
13  * to the University of California by American Telephone and Telegraph
14  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
15  * the permission of UNIX System Laboratories, Inc.
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions
19  * are met:
20  * 1. Redistributions of source code must retain the above copyright
21  *    notice, this list of conditions and the following disclaimer.
22  * 2. Redistributions in binary form must reproduce the above copyright
23  *    notice, this list of conditions and the following disclaimer in the
24  *    documentation and/or other materials provided with the distribution.
25  * 3. Neither the name of the University nor the names of its contributors
26  *    may be used to endorse or promote products derived from this software
27  *    without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39  * SUCH DAMAGE.
40  *
41  *	@(#)time.h	5.12 (Berkeley) 3/9/91
42  */
43 
44 #ifndef _TIME_H_
45 #define	_TIME_H_
46 
47 #include <machine/types.h>
48 #include <machine/ansi.h>
49 #include <syskern/mirtime.h>
50 
51 #ifndef	NULL
52 #ifdef 	__GNUG__
53 #define	NULL	__null
54 #elif defined(lint)
55 #define	NULL	0
56 #else
57 #define	NULL	((void *)((__PTRDIFF_TYPE__)0UL))
58 #endif
59 #endif
60 
61 #ifdef	_BSD_CLOCK_T_
62 typedef	_BSD_CLOCK_T_	clock_t;
63 #undef	_BSD_CLOCK_T_
64 #endif
65 
66 #if !defined(_GCC_SIZE_T)
67 #define	_GCC_SIZE_T
68 typedef	__SIZE_TYPE__	size_t;
69 #endif
70 
71 /* C11 optional */
72 #if !defined(__STDC_WANT_LIB_EXT1__) || (__STDC_WANT_LIB_EXT1__)
73 #ifndef rsize_t
74 #define rsize_t		rsize_t
75 typedef size_t		rsize_t;
76 #endif
77 #endif /* __STDC_WANT_LIB_EXT1__ */
78 
79 #define CLOCKS_PER_SEC	100
80 
81 __BEGIN_DECLS
82 #ifndef _ANSI_LIBRARY
83 struct timespec;
84 #endif
85 char *asctime(const struct tm *);
86 clock_t clock(void);
87 char *ctime(const time_t *);
88 double difftime(time_t, time_t);
89 struct tm *gmtime(const time_t *);
90 struct tm *localtime(const time_t *);
91 time_t mktime(struct tm *);
92 size_t strftime(char *, size_t, const char *, const struct tm *)
93 		__attribute__((__bounded__(__string__, 1, 2)));
94 char *strptime(const char *, const char *, struct tm *);
95 time_t time(time_t *);
96 char *asctime_r(const struct tm *, char *)
97 		__attribute__((__bounded__(__minbytes__, 2, 26)));
98 char *ctime_r(const time_t *, char *)
99 		__attribute__((__bounded__(__minbytes__, 2, 26)));
100 struct tm *gmtime_r(const time_t *, struct tm *);
101 struct tm *localtime_r(const time_t *, struct tm *);
102 #ifndef _ANSI_LIBRARY
103 int nanosleep(const struct timespec *, struct timespec *);
104 #endif
105 
106 #if !defined(_ANSI_SOURCE)
107 #define CLK_TCK		100
108 extern char *tzname[2];
109 void tzset(void);
110 #endif /* not ANSI */
111 
112 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
113 char *timezone(int, int);
114 void tzsetwall(void);
115 time_t timelocal(struct tm *);
116 time_t timegm(struct tm *);
117 time_t timeoff(struct tm *, const long);
118 #endif /* neither ANSI nor POSIX */
119 __END_DECLS
120 
121 #endif /* !_TIME_H_ */
122