1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 1988-2003 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 /* Copyright (c) 1988 AT&T */ 28 /* All Rights Reserved */ 29 30 #ifndef _TZFILE_H 31 #define _TZFILE_H 32 33 #pragma ident "%Z%%M% %I% %E% SMI" 34 35 /* 36 * A part of this file comes from public domain source, so 37 * clarified as of June 5, 1996 by Arthur David Olson 38 * (arthur_david_olson@nih.gov). 39 */ 40 41 #include <sys/types.h> 42 43 /* 44 * WARNING: 45 * The interfaces defined in this header file are for Sun private use only. 46 * The contents of this file are subject to change without notice for the 47 * future releases. 48 */ 49 50 /* For further information, see ctime(3C) and zic(1M) man pages. */ 51 52 /* 53 * This file is in the public domain, so clarified as of 54 * June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov). 55 */ 56 57 /* 58 * This header is for use ONLY with the time conversion code. 59 * There is no guarantee that it will remain unchanged, 60 * or that it will remain at all. 61 * Do NOT copy it to any system include directory. 62 * Thank you! 63 */ 64 65 /* 66 * Note: Despite warnings from the authors of this code, Solaris has 67 * placed this header file in the system include directory. This was 68 * probably done in order to build both zic and zdump which are in 69 * separate source directories, but both use this file. 70 */ 71 72 #ifdef __cplusplus 73 extern "C" { 74 #endif 75 76 /* 77 * Information about time zone files. 78 */ 79 80 #ifndef TZDIR 81 #define TZDIR "/usr/share/lib/zoneinfo" /* Time zone object file directory */ 82 #endif /* !defined TZDIR */ 83 84 #ifndef TZDEFAULT 85 #define TZDEFAULT "localtime" 86 #endif /* !defined TZDEFAULT */ 87 88 #ifndef TZDEFRULES 89 #define TZDEFRULES "posixrules" 90 #endif /* !defined TZDEFRULES */ 91 92 /* 93 * Each file begins with. . . 94 */ 95 96 #define TZ_MAGIC "TZif" 97 98 struct tzhead { 99 char tzh_magic[4]; /* TZ_MAGIC */ 100 char tzh_reserved[16]; /* reserved for future use */ 101 char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ 102 char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ 103 char tzh_leapcnt[4]; /* coded number of leap seconds */ 104 char tzh_timecnt[4]; /* coded number of transition times */ 105 char tzh_typecnt[4]; /* coded number of local time types */ 106 char tzh_charcnt[4]; /* coded number of abbr. chars */ 107 }; 108 109 /* 110 * . . .followed by. . . 111 * 112 * tzh_timecnt (char [4])s coded transition times a la time(2) 113 * tzh_timecnt (unsigned char)s types of local time starting at above 114 * tzh_typecnt repetitions of 115 * one (char [4]) coded UTC offset in seconds 116 * one (unsigned char) used to set tm_isdst 117 * one (unsigned char) that's an abbreviation list index 118 * tzh_charcnt (char)s '\0'-terminated zone abbreviations 119 * tzh_leapcnt repetitions of 120 * one (char [4]) coded leap second transition times 121 * one (char [4]) total correction after above 122 * tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition 123 * time is standard time, if FALSE, 124 * transition time is wall clock time 125 * if absent, transition times are 126 * assumed to be wall clock time 127 * tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition 128 * time is UTC, if FALSE, 129 * transition time is local time 130 * if absent, transition times are 131 * assumed to be local time 132 */ 133 134 /* 135 * In the current implementation, "tzset()" refuses to deal with files that 136 * exceed any of the limits below. 137 */ 138 139 #ifndef TZ_MAX_TIMES 140 /* 141 * The TZ_MAX_TIMES value below is enough to handle a bit more than a 142 * year's worth of solar time (corrected daily to the nearest second) or 143 * 138 years of Pacific Presidential Election time 144 * (where there are three time zone transitions every fourth year). 145 */ 146 #define TZ_MAX_TIMES 370 147 #endif /* !defined TZ_MAX_TIMES */ 148 149 #ifndef TZ_MAX_TYPES 150 #ifndef NOSOLAR 151 #define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ 152 #endif /* !defined NOSOLAR */ 153 #ifdef NOSOLAR 154 /* 155 * Must be at least 14 for Europe/Riga as of Jan 12 1995, 156 * as noted by Earl Chew <earl@hpato.aus.hp.com>. 157 */ 158 #define TZ_MAX_TYPES 20 /* Maximum number of local time types */ 159 #endif /* !defined NOSOLAR */ 160 #endif /* !defined TZ_MAX_TYPES */ 161 162 #ifndef TZ_MAX_CHARS 163 #define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ 164 /* (limited by what unsigned chars can hold) */ 165 #endif /* !defined TZ_MAX_CHARS */ 166 167 #ifndef TZ_MAX_LEAPS 168 #define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ 169 #endif /* !defined TZ_MAX_LEAPS */ 170 171 #define SECSPERMIN 60 172 #define MINSPERHOUR 60 173 #define HOURSPERDAY 24 174 #define DAYSPERWEEK 7 175 #define DAYSPERNYEAR 365 176 #define DAYSPERLYEAR 366 177 #define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) 178 #define SECSPERDAY ((time_t)SECSPERHOUR * HOURSPERDAY) 179 #define MONSPERYEAR 12 180 181 #define TM_SUNDAY 0 182 #define TM_MONDAY 1 183 #define TM_TUESDAY 2 184 #define TM_WEDNESDAY 3 185 #define TM_THURSDAY 4 186 #define TM_FRIDAY 5 187 #define TM_SATURDAY 6 188 189 #define TM_JANUARY 0 190 #define TM_FEBRUARY 1 191 #define TM_MARCH 2 192 #define TM_APRIL 3 193 #define TM_MAY 4 194 #define TM_JUNE 5 195 #define TM_JULY 6 196 #define TM_AUGUST 7 197 #define TM_SEPTEMBER 8 198 #define TM_OCTOBER 9 199 #define TM_NOVEMBER 10 200 #define TM_DECEMBER 11 201 202 #define TM_YEAR_BASE 1900 203 204 #define EPOCH_YEAR 1970 205 #define EPOCH_WDAY TM_THURSDAY 206 207 /* 208 * Accurate only for the past couple of centuries; 209 * that will probably do. 210 */ 211 212 #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) 213 214 #ifndef USG 215 216 /* 217 * Use of the underscored variants may cause problems if you move your code to 218 * certain System-V-based systems; for maximum portability, use the 219 * underscore-free variants. The underscored variants are provided for 220 * backward compatibility only; they may disappear from future versions of 221 * this file. 222 */ 223 224 #define SECS_PER_MIN SECSPERMIN 225 #define MINS_PER_HOUR MINSPERHOUR 226 #define HOURS_PER_DAY HOURSPERDAY 227 #define DAYS_PER_WEEK DAYSPERWEEK 228 #define DAYS_PER_NYEAR DAYSPERNYEAR 229 #define DAYS_PER_LYEAR DAYSPERLYEAR 230 #define SECS_PER_HOUR SECSPERHOUR 231 #define SECS_PER_DAY SECSPERDAY 232 #define MONS_PER_YEAR MONSPERYEAR 233 234 #endif /* !defined USG */ 235 236 #ifdef __cplusplus 237 } 238 #endif 239 240 #endif /* _TZFILE_H */ 241