00001 /*------------------------------------------------------------------------- 00002 * 00003 * pgtz.h 00004 * Timezone Library Integration Functions 00005 * 00006 * Note: this file contains only definitions that are private to the 00007 * timezone library. Public definitions are in pgtime.h. 00008 * 00009 * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group 00010 * 00011 * IDENTIFICATION 00012 * src/timezone/pgtz.h 00013 * 00014 *------------------------------------------------------------------------- 00015 */ 00016 #ifndef _PGTZ_H 00017 #define _PGTZ_H 00018 00019 #include "tzfile.h" 00020 #include "pgtime.h" 00021 00022 00023 #define BIGGEST(a, b) (((a) > (b)) ? (a) : (b)) 00024 00025 struct ttinfo 00026 { /* time type information */ 00027 long tt_gmtoff; /* UTC offset in seconds */ 00028 int tt_isdst; /* used to set tm_isdst */ 00029 int tt_abbrind; /* abbreviation list index */ 00030 int tt_ttisstd; /* TRUE if transition is std time */ 00031 int tt_ttisgmt; /* TRUE if transition is UTC */ 00032 }; 00033 00034 struct lsinfo 00035 { /* leap second information */ 00036 pg_time_t ls_trans; /* transition time */ 00037 long ls_corr; /* correction to apply */ 00038 }; 00039 00040 struct state 00041 { 00042 int leapcnt; 00043 int timecnt; 00044 int typecnt; 00045 int charcnt; 00046 int goback; 00047 int goahead; 00048 pg_time_t ats[TZ_MAX_TIMES]; 00049 unsigned char types[TZ_MAX_TIMES]; 00050 struct ttinfo ttis[TZ_MAX_TYPES]; 00051 char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, 3 /* sizeof gmt */ ), 00052 (2 * (TZ_STRLEN_MAX + 1)))]; 00053 struct lsinfo lsis[TZ_MAX_LEAPS]; 00054 }; 00055 00056 00057 struct pg_tz 00058 { 00059 /* TZname contains the canonically-cased name of the timezone */ 00060 char TZname[TZ_STRLEN_MAX + 1]; 00061 struct state state; 00062 }; 00063 00064 00065 /* in pgtz.c */ 00066 extern int pg_open_tzfile(const char *name, char *canonname); 00067 00068 /* in localtime.c */ 00069 extern int tzload(const char *name, char *canonname, struct state * sp, 00070 int doextend); 00071 extern int tzparse(const char *name, struct state * sp, int lastditch); 00072 00073 #endif /* _PGTZ_H */