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 * The maximum length, including the terminating NUL, of a single time zone 31 * abbreviation. We carry our own definition here so that consumers of 32 * tzinfo_ctx_t need not pull in <tzfile.h>; localtime.c asserts that the two 33 * agree. 34 */ 35 #define TZC_ABBR_MAX 50 36 37 /* 38 * This represents the global state that is normally associated with calling 39 * tzset(). 40 */ 41 typedef struct tzinfo_ctx { 42 const char *tzc_tzname[2]; 43 char tzc_namebuf[2][TZC_ABBR_MAX]; 44 long tzc_timezone; 45 long tzc_altzone; 46 int tzc_daylight; 47 int tzc_is_in_dst; 48 } tzinfo_ctx_t; 49 50 /* 51 * Using the currently set timezone calculate the timezone and offset rules for 52 * the specified time. This is not going to be the same as what is set by 53 * calling tzset() as tzset() is generally based on the current time. This will 54 * hold _time_lock during it, but no effort is made to guarantee that this is 55 * consistent with a corresponding call to tzset(). That should be dealt with in 56 * the future by internally (and possibly externally) adding the tzalloc() and 57 * related APIs. 58 */ 59 extern void tzinfo_tm_to_ctx(const struct tm *, tzinfo_ctx_t *); 60 61 #ifdef __cplusplus 62 } 63 #endif 64 65 #endif /* _TZINT_H */ 66