OSDN Git Service

Removed unsigned/signed mismatches.
[pg-rex/syncrep.git] / src / timezone / pgtz.h
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-2009, PostgreSQL Global Development Group
10  *
11  * IDENTIFICATION
12  *        $PostgreSQL: pgsql/src/timezone/pgtz.h,v 1.23 2009/01/01 17:24:04 momjian Exp $
13  *
14  *-------------------------------------------------------------------------
15  */
16 #ifndef _PGTZ_H
17 #define _PGTZ_H
18
19 #include "tzfile.h"
20 #include "pgtime.h"
21
22
23 #define BIGGEST(a, b)   (((a) > (b)) ? (a) : (b))
24
25 struct ttinfo
26 {                                                               /* time type information */
27         long            tt_gmtoff;              /* UTC offset in seconds */
28         int                     tt_isdst;               /* used to set tm_isdst */
29         int                     tt_abbrind;             /* abbreviation list index */
30         int                     tt_ttisstd;             /* TRUE if transition is std time */
31         int                     tt_ttisgmt;             /* TRUE if transition is UTC */
32 };
33
34 struct lsinfo
35 {                                                               /* leap second information */
36         pg_time_t       ls_trans;               /* transition time */
37         long            ls_corr;                /* correction to apply */
38 };
39
40 struct state
41 {
42         int                     leapcnt;
43         int                     timecnt;
44         int                     typecnt;
45         int                     charcnt;
46         int                     goback;
47         int                     goahead;
48         pg_time_t       ats[TZ_MAX_TIMES];
49         unsigned char types[TZ_MAX_TIMES];
50         struct ttinfo ttis[TZ_MAX_TYPES];
51         char            chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, 3 /* sizeof gmt */ ),
52                                                                                   (2 * (TZ_STRLEN_MAX + 1)))];
53         struct lsinfo lsis[TZ_MAX_LEAPS];
54 };
55
56
57 struct pg_tz
58 {
59         /* TZname contains the canonically-cased name of the timezone */
60         char            TZname[TZ_STRLEN_MAX + 1];
61         struct state state;
62 };
63
64
65 /* in pgtz.c */
66 extern int      pg_open_tzfile(const char *name, char *canonname);
67
68 /* in localtime.c */
69 extern int      tzload(const char *name, char *canonname, struct state * sp, 
70                                    int doextend);
71 extern int      tzparse(const char *name, struct state * sp, int lastditch);
72
73 #endif   /* _PGTZ_H */