~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to src/timezone/pgtz.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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-2011, 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 "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 */