15 {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0},
16{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0}};
23 {
"acsst",
DTZ, 37800},
24 {
"acst",
DTZ, -14400},
28 {
"aesst",
DTZ, 39600},
32 {
"akdt",
DTZ, -28800},
33 {
"akst",
DTZ, -32400},
40 {
"amst",
DTZ, -10800},
43 {
"anast",
DTZ, 46800},
62 {
"awsst",
DTZ, 32400},
101 {
"cetdst",
DTZ, 7200},
102 {
"chadt",
DTZ, 49500},
103 {
"chast",
TZ, 45900},
108 {
"clst",
DTZ, -10800},
124 {
"december",
MONTH, 12},
130 {
"dusst",
DTZ, 21600},
132 {
"easst",
DTZ, -18000},
133 {
"east",
TZ, -21600},
136 {
"east",
DTZ, 14400},
141 {
"edt",
DTZ, -14400},
142 {
"eest",
DTZ, 10800},
144 {
"eetdst",
DTZ, 10800},
153 {
"february",
MONTH, 2},
154 {
"fjst",
DTZ, -46800},
156 {
"fkst",
DTZ, -10800},
166 {
"galt",
TZ, -21600},
167 {
"gamt",
TZ, -32400},
168 {
"gest",
DTZ, 18000},
183 {
"hdt",
DTZ, -32400},
199 {
"idlw",
TZ, -43200},
205 {
"irkst",
DTZ, 32400},
216 {
"january",
MONTH, 1},
228 {
"kgst",
DTZ, 21600},
231 {
"krast",
DTZ, 25200},
234 {
"lhdt",
DTZ, 39600},
240 {
"magst",
DTZ, 43200},
244 {
"mart",
TZ, -34200},
247 {
"mdt",
DTZ, -21600},
250 {
"metdst",
DTZ, 7200},
277 {
"november",
MONTH, 11},
278 {
"novst",
DTZ, 25200},
285 {
"nzdt",
DTZ, 46800},
289 {
"october",
MONTH, 10},
290 {
"omsst",
DTZ, 25200},
293 {
"pdt",
DTZ, -25200},
298 {
"petst",
DTZ, 46800},
308 {
"pmdt",
DTZ, -7200},
315 {
"pyst",
DTZ, -10800},
319 {
"sadt",
DTZ, 37800},
326 {
"saturday",
DOW, 6},
333 {
"september",
MONTH, 9},
347 {
"that",
TZ, -36000},
351 {
"thursday",
DOW, 4},
372 {
"ulast",
DTZ, 32400},
376 {
"uyst",
DTZ, -7200},
378 {
"uzst",
DTZ, 21600},
381 {
"vlast",
DTZ, 39600},
387 {
"wadt",
DTZ, 28800},
396 {
"wednesday",
DOW, 3},
400 {
"wetdst",
DTZ, 3600},
402 {
"wgst",
DTZ, -7200},
406 {
"yakst",
DTZ, 36000},
409 {
"ydt",
DTZ, -28800},
410 {
"yekst",
DTZ, 21600},
493char *
months[] = {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
NULL};
495char *
days[] = {
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
NULL};
499char *
pgtypes_date_months[] = {
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
NULL};
512 position = base + ((last - base) >> 1);
514 result = (
int) key[0] - (
int) position->token[0];
600 julian += 7834 * m / 256 + d;
626 *month = (
quad + 10) % 12 + 1;
727 while (*(
str +
len - 1) ==
'0' && *(
str +
len - 3) !=
'.')
999#if defined(HAVE_STRUCT_TM_TM_ZONE)
1027#elif defined(HAVE_INT_TIMEZONE)
1113 for (
i = 0;
i < 6;
i++)
1225 else if (*
cp !=
'\0')
1356 for (
i = 0;
i <
nf;
i++)
1358 if (
isalpha((
unsigned char) *field[
i]))
1390 for (
i = 0;
i <
nf;
i++)
1392 if (field[
i] ==
NULL)
1453 else if (*
cp !=
':')
1461 else if (*
cp ==
'.')
1476 for (
i = 0;
i < 6;
i++)
1556 while (*
cp !=
'\0' &&
isalpha((
unsigned char) *
cp))
1608 while (*(*
endstr) !=
'\0')
1618 *
lp++ = *(*endstr)++;
1620 *
lp++ = *(*endstr)++;
1626 *
lp++ = *(*endstr)++;
1629 *
lp++ = *(*endstr)++;
1635 char *
dp = (*endstr);
1637 *
lp++ = *(*endstr)++;
1643 *
lp++ = *(*endstr)++;
1652 *
lp++ = *(*endstr)++;
1654 *
lp++ = *(*endstr)++;
1673 else if (*(*
endstr) ==
'.')
1675 *
lp++ = *(*endstr)++;
1677 *
lp++ = *(*endstr)++;
1698 char *
dp = (*endstr);
1701 *
lp++ = *(*endstr)++;
1703 *
lp++ = *(*endstr)++;
1715 *
lp++ = *(*endstr)++;
1723 *
lp++ = *(*endstr)++;
1726 *
lp++ = *(*endstr)++;
1812 for (
i = 0;
i <
nf;
i++)
1856 if (
isdigit((
unsigned char) *field[
i]) || ptype != 0)
1941 isalpha((
unsigned char) *field[
i - 1]))
1982 else if (*
cp !=
'\0')
2036 *fsec =
frac * 1000000;
2471 while (**
pstr ==
' ')
2490 while (**
pstr ==
' ')
2498 while (**
pstr ==
' ')
2522 int *year,
int *month,
int *day,
2542 while (*
pfmt ==
' ')
2544 while (*
pstr ==
' ')
2793 strcpy(tmp,
"%I:%M:%S %p");
2822 *year =
tms->tm_year + 1900;
2823 *month =
tms->tm_mon + 1;
2824 *day =
tms->tm_mday;
2827 *second =
tms->tm_sec;
2985 (*
hour == 24 && (*
minute > 0 || *second > 0)))
int tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result)
#define Assert(condition)
void EncodeDateOnly(struct tm *tm, int style, char *str, bool EuroDates)
int GetEpochTime(struct tm *tm)
int PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp *d, int *year, int *month, int *day, int *hour, int *minute, int *second, int *tz)
void EncodeDateTime(struct tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str, bool EuroDates)
void TrimTrailingZeros(char *str)
void GetCurrentDateTime(struct tm *tm)
static int DecodeTimezone(char *str, int *tzp)
static const datetkn datetktbl[]
static const unsigned int szdatetktbl
static int DecodePosixTimezone(char *str, int *tzp)
static const datetkn * deltacache[MAXDATEFIELDS]
static void abstime2tm(AbsoluteTime _time, int *tzp, struct tm *tm, char **tzn)
static const datetkn * datecache[MAXDATEFIELDS]
int DecodeTime(char *str, int *tmask, struct tm *tm, fsec_t *fsec)
int date2j(int y, int m, int d)
static int DecodeNumber(int flen, char *str, int fmask, int *tmask, struct tm *tm, fsec_t *fsec, bool *is2digits, bool EuroDates)
int ParseDateTime(char *timestr, char *lowstr, char **field, int *ftype, int *numfields, char **endstr)
static int DecodeSpecial(int field, char *lowtoken, int *val)
void j2date(int jd, int *year, int *month, int *day)
int DecodeDateTime(char **field, int *ftype, int nf, int *dtype, struct tm *tm, fsec_t *fsec, bool EuroDates)
static const datetkn * datebsearch(const char *key, const datetkn *base, unsigned int nel)
static int DecodeNumberField(int len, char *str, int fmask, int *tmask, struct tm *tm, fsec_t *fsec, bool *is2digits)
char * pgtypes_date_months[]
char * pgtypes_date_weekdays_short[]
void dt2time(double jd, int *hour, int *min, int *sec, fsec_t *fsec)
int DecodeUnits(int field, char *lowtoken, int *val)
static char * find_end_token(char *str, char *fmt)
static const unsigned int szdeltatktbl
static const datetkn deltatktbl[]
static int DecodeDate(char *str, int fmask, int *tmask, struct tm *tm, bool EuroDates)
static int pgtypes_defmt_scan(union un_fmt_comb *scan_val, int scan_type, char **pstr, char *pfmt)
void err(int eval, const char *fmt,...)
char * pgtypes_strdup(const char *str)
char * pgtypes_alloc(long size)
#define USE_POSTGRES_DATES
#define PGTYPES_TS_BAD_TIMESTAMP
#define PGTYPES_TYPE_UINT
#define PGTYPES_TYPE_STRING_MALLOCED
#define PGTYPES_TYPE_UINT_LONG
int pg_strcasecmp(const char *s1, const char *s2)
unsigned char pg_tolower(unsigned char ch)
size_t strlcpy(char *dst, const char *src, size_t siz)
int strtoint(const char *pg_restrict str, char **pg_restrict endptr, int base)
static const unsigned __int64 epoch