xref: /illumos-gate/usr/src/lib/libc/inc/tzint.h (revision 83cfce2593d5879e6831dd040afbd71e613d50f5)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2026 Oxide Computer Company
14  */
15 
16 #ifndef _TZINT_H
17 #define	_TZINT_H
18 
19 /*
20  * Time Zone Internal functions for libc. This contains a few extras that we
21  * have to deal with the fact that we don't have tm_zone and other extras that
22  * we want for ourselves, but are not part of public interfaces.
23  */
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 /*
30  * This represents the global state that is normally associated with calling
31  * tzset().
32  */
33 typedef struct tzinfo_ctx {
34 	const char *tzc_tzname[2];
35 	long tzc_timezone;
36 	long tzc_altzone;
37 	int tzc_daylight;
38 	int tzc_is_in_dst;
39 } tzinfo_ctx_t;
40 
41 /*
42  * Using the currently set timezone calculate the timezone and offset rules for
43  * the specified time. This is not going to be the same as what is set by
44  * calling tzset() as tzset() is generally based on the current time. This will
45  * hold _time_lock during it, but no effort is made to guarantee that this is
46  * consistent with a corresponding call to tzset(). That should be dealt with in
47  * the future by internally (and possibly externally) adding the tzalloc() and
48  * related APIs.
49  */
50 extern void tzinfo_tm_to_ctx(const struct tm *, tzinfo_ctx_t *);
51 
52 #ifdef __cplusplus
53 }
54 #endif
55 
56 #endif /* _TZINT_H */
57