PostgreSQL Source Code git master
Loading...
Searching...
No Matches
pgtz.h File Reference
#include "pgtime.h"
#include "tzfile.h"
Include dependency graph for pgtz.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ttinfo
 
struct  lsinfo
 
struct  state
 
struct  pg_tz
 

Macros

#define TZ_RUNTIME_LEAPS   1
 
#define TZNAME_MAXIMUM   254
 

Typedefs

typedef unsigned char desigidx_type
 
typedef int_fast32_t int_fast32_2s
 

Enumerations

enum  { CHARS_EXTRA = Max(sizeof UNSPEC, 2) - 1 }
 

Functions

int pg_open_tzfile (const char *name, char *canonname)
 
bool pg_tzload (const char *name, char *canonname, struct state *sp)
 

Variables

static char const UNSPEC [] = "-00"
 

Macro Definition Documentation

◆ TZ_RUNTIME_LEAPS

#define TZ_RUNTIME_LEAPS   1

Definition at line 26 of file pgtz.h.

◆ TZNAME_MAXIMUM

#define TZNAME_MAXIMUM   254

Definition at line 37 of file pgtz.h.

Typedef Documentation

◆ desigidx_type

Definition at line 39 of file pgtz.h.

◆ int_fast32_2s

Definition at line 45 of file pgtz.h.

Enumeration Type Documentation

◆ anonymous enum

Enumerator
CHARS_EXTRA 

Definition at line 72 of file pgtz.h.

73{
74CHARS_EXTRA = Max(sizeof UNSPEC, 2) - 1};
#define Max(x, y)
Definition c.h:1125
@ CHARS_EXTRA
Definition pgtz.h:74
static char const UNSPEC[]
Definition pgtz.h:64

Function Documentation

◆ pg_open_tzfile()

int pg_open_tzfile ( const char name,
char canonname 
)
extern

Definition at line 65 of file findtimezone.c.

66{
67 char fullname[MAXPGPATH];
68
69 if (canonname)
71
72 strlcpy(fullname, pg_TZDIR(), sizeof(fullname));
73 if (strlen(fullname) + 1 + strlen(name) >= MAXPGPATH)
74 return -1; /* not gonna fit */
75 strcat(fullname, "/");
77
78 return open(fullname, O_RDONLY | PG_BINARY, 0);
79}
#define PG_BINARY
Definition c.h:1431
static const char * pg_TZDIR(void)
#define MAXPGPATH
#define TZ_STRLEN_MAX
Definition pgtime.h:54
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition strlcpy.c:45
static int fb(int x)
const char * name

References fb(), MAXPGPATH, name, PG_BINARY, pg_TZDIR(), pg_TZDIR(), result, scan_directory_ci(), strlcpy(), and TZ_STRLEN_MAX.

Referenced by tzloadbody().

◆ pg_tzload()

bool pg_tzload ( const char name,
char canonname,
struct state sp 
)
extern

Definition at line 1590 of file localtime.c.

1591{
1592 if (strcmp(name, "GMT") == 0)
1593 {
1594 gmtload(sp);
1595 /* Use given name as canonical */
1596 if (canonname)
1598 }
1599 else if (tzload(name, canonname, sp, TZLOAD_TZSTRING) != 0)
1600 {
1601 if (name[0] == ':' || !tzparse(name, sp, NULL))
1602 {
1603 /* Unknown timezone. Fail our call instead of loading GMT! */
1604 return false;
1605 }
1606 /* For POSIX timezone specs, use given name as canonical */
1607 if (canonname)
1609 }
1610 return true;
1611}
static bool tzparse(const char *name, struct state *sp, struct state const *basep)
Definition localtime.c:949
static int tzload(char const *name, char *canonname, struct state *sp, char tzloadflags)
Definition localtime.c:618
static void gmtload(struct state *const sp)
Definition localtime.c:1172
@ TZLOAD_TZSTRING
Definition localtime.c:248

References fb(), gmtload(), name, tzload(), TZLOAD_TZSTRING, and tzparse().

Referenced by pg_load_tz(), pg_tzenumerate_next(), and pg_tzset().

Variable Documentation

◆ UNSPEC

char const UNSPEC[] = "-00"
static

Definition at line 64 of file pgtz.h.