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