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