PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
pgtz.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pgtz.h
4  * Timezone Library Integration Functions
5  *
6  * Note: this file contains only definitions that are private to the
7  * timezone library. Public definitions are in pgtime.h.
8  *
9  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
10  *
11  * IDENTIFICATION
12  * src/timezone/pgtz.h
13  *
14  *-------------------------------------------------------------------------
15  */
16 #ifndef _PGTZ_H
17 #define _PGTZ_H
18 
19 #include "pgtime.h"
20 #include "tzfile.h"
21 
22 
23 #define SMALLEST(a, b) (((a) < (b)) ? (a) : (b))
24 #define BIGGEST(a, b) (((a) > (b)) ? (a) : (b))
25 
26 struct ttinfo
27 { /* time type information */
28  int32 tt_gmtoff; /* UT offset in seconds */
29  bool tt_isdst; /* used to set tm_isdst */
30  int tt_abbrind; /* abbreviation list index */
31  bool tt_ttisstd; /* transition is std time */
32  bool tt_ttisgmt; /* transition is UT */
33 };
34 
35 struct lsinfo
36 { /* leap second information */
37  pg_time_t ls_trans; /* transition time */
38  int64 ls_corr; /* correction to apply */
39 };
40 
41 struct state
42 {
43  int leapcnt;
44  int timecnt;
45  int typecnt;
46  int charcnt;
47  bool goback;
48  bool goahead;
50  unsigned char types[TZ_MAX_TIMES];
52  char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, 3 /* sizeof gmt */ ),
53  (2 * (TZ_STRLEN_MAX + 1)))];
55  int defaulttype; /* for early times or if no transitions */
56 };
57 
58 
59 struct pg_tz
60 {
61  /* TZname contains the canonically-cased name of the timezone */
62  char TZname[TZ_STRLEN_MAX + 1];
63  struct state state;
64 };
65 
66 
67 /* in pgtz.c */
68 extern int pg_open_tzfile(const char *name, char *canonname);
69 
70 /* in localtime.c */
71 extern int tzload(const char *name, char *canonname, struct state * sp,
72  bool doextend);
73 extern bool tzparse(const char *name, struct state * sp, bool lastditch);
74 
75 #endif /* _PGTZ_H */
int tzload(const char *name, char *canonname, struct state *sp, bool doextend)
Definition: localtime.c:537
int64 pg_time_t
Definition: pgtime.h:23
int charcnt
Definition: pgtz.h:46
bool goback
Definition: pgtz.h:47
int32 tt_gmtoff
Definition: pgtz.h:28
int leapcnt
Definition: pgtz.h:43
Definition: pgtz.h:26
#define TZ_MAX_TIMES
Definition: tzfile.h:93
pg_time_t ats[TZ_MAX_TIMES]
Definition: pgtz.h:49
signed int int32
Definition: c.h:256
#define BIGGEST(a, b)
Definition: pgtz.h:24
#define TZ_MAX_LEAPS
Definition: tzfile.h:101
bool tt_isdst
Definition: pgtz.h:29
struct lsinfo lsis[TZ_MAX_LEAPS]
Definition: pgtz.h:54
#define TZ_STRLEN_MAX
Definition: pgtime.h:44
int64 ls_corr
Definition: pgtz.h:38
pg_time_t ls_trans
Definition: pgtz.h:37
char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS+1, 3),(2 *(TZ_STRLEN_MAX+1)))]
Definition: pgtz.h:53
#define TZ_MAX_CHARS
Definition: tzfile.h:98
Definition: pgtz.h:59
struct ttinfo ttis[TZ_MAX_TYPES]
Definition: pgtz.h:51
unsigned char types[TZ_MAX_TIMES]
Definition: pgtz.h:50
Definition: regguts.h:298
int timecnt
Definition: pgtz.h:44
Definition: pgtz.h:35
int pg_open_tzfile(const char *name, char *canonname)
Definition: findtimezone.c:64
char TZname[TZ_STRLEN_MAX+1]
Definition: pgtz.h:62
bool tt_ttisstd
Definition: pgtz.h:31
const char * name
Definition: encode.c:521
#define TZ_MAX_TYPES
Definition: tzfile.h:96
int tt_abbrind
Definition: pgtz.h:30
bool tzparse(const char *name, struct state *sp, bool lastditch)
Definition: localtime.c:878
bool tt_ttisgmt
Definition: pgtz.h:32
bool goahead
Definition: pgtz.h:48
int typecnt
Definition: pgtz.h:45
int defaulttype
Definition: pgtz.h:55