1/* 2 timezone.h - Zip 3 3 4 Copyright (c) 1990-2004 Info-ZIP. All rights reserved. 5 6 See the accompanying file LICENSE, version 2003-May-08 or later 7 (the contents of which are also included in zip.h) for terms of use. 8 If, for some reason, all these files are missing, the Info-ZIP license 9 also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 10*/ 11#ifndef __timezone_h 12#define __timezone_h 13 14#ifndef IZ_MKTIME_ONLY 15 16/* limits for our timezone info data: 17 * we support only basic standard and daylight time, with max 2 transitions 18 * per year, but for the maximum range of years a 32-bit second counter 19 * can cover (these are 136 years plus a bit more than one month) 20 */ 21#define TZ_MAX_TIMES 272 /* (=2*(LastGoodYr + 1 - FirstGoodYr) */ 22#define TZ_MAX_TYPES 2 /* We only support basic standard and daylight */ 23#ifdef WIN32 /* Win32 tzinfo supplies at max (2 * 32) chars of tz names */ 24#define TZ_MAX_CHARS 64 /* Maximum number of abbreviation characters */ 25#else 26#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ 27#endif 28 29/* supported types of transition rules */ 30#define JULIAN_DAY 0 /* Jn - Julian day */ 31#define DAY_OF_YEAR 1 /* n - day of year */ 32#define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */ 33 34 35struct ttinfo { 36 long tt_gmtoff; /* UTC offset in seconds */ 37 int tt_isdst; /* used to set tm_isdst */ 38 int tt_abbrind; /* abbreviation list index */ 39}; 40 41struct state { 42 int timecnt; 43 int typecnt; 44 int charcnt; 45 time_t ats[TZ_MAX_TIMES]; 46 unsigned char types[TZ_MAX_TIMES]; 47 struct ttinfo ttis[TZ_MAX_TYPES]; 48 char chars[TZ_MAX_CHARS]; 49}; 50 51struct rule { 52 int r_type; /* type of rule--JULIAN_DAY etc */ 53 int r_day; /* day number of rule */ 54 int r_week; /* week number of rule */ 55 int r_mon; /* month number of rule */ 56 long r_time; /* transition time of rule */ 57}; 58 59extern int real_timezone_is_set; /* set by tzset() */ 60 61 62/* prototypes of functions not in time.h */ 63 64void __tzset OF((void)); 65 66#ifdef NEED__ISINDST 67int _isindst OF((struct tm *tb)); 68#endif 69 70/* callback function to be supplied by the program that uses this library */ 71int GetPlatformLocalTimezone OF((register struct state * ZCONST sp, 72 void (*fill_tzstate_from_rules)(struct state * ZCONST sp_res, 73 ZCONST struct rule * ZCONST start, 74 ZCONST struct rule * ZCONST end))); 75#ifdef IZTZ_SETLOCALTZINFO 76void set_TZ OF((long time_zone, int day_light)); 77#endif 78 79#endif /* !IZ_MKTIME_ONLY */ 80 81time_t mkgmtime OF((struct tm *tm)); 82 83#endif 84