37 #define DCURRENT "current" 39 #define INVALID "invalid" 40 #define EARLY "-infinity" 41 #define LATE "infinity" 44 #define TOMORROW "tomorrow" 45 #define YESTERDAY "yesterday" 48 #define DMICROSEC "usecond" 49 #define DMILLISEC "msecond" 50 #define DSECOND "second" 51 #define DMINUTE "minute" 55 #define DMONTH "month" 56 #define DQUARTER "quarter" 58 #define DDECADE "decade" 59 #define DCENTURY "century" 60 #define DMILLENNIUM "millennium" 63 #define DTIMEZONE "timezone" 104 #define MILLISECOND 13 105 #define MICROSECOND 14 112 #define ABS_BEFORE 20 121 #define MILLENNIUM 27 125 #define UNKNOWN_FIELD 31 150 #define DTK_SPECIAL 6 155 #define DTK_YESTERDAY 13 157 #define DTK_TOMORROW 15 161 #define DTK_SECOND 18 162 #define DTK_MINUTE 19 167 #define DTK_QUARTER 24 169 #define DTK_DECADE 26 170 #define DTK_CENTURY 27 171 #define DTK_MILLENNIUM 28 172 #define DTK_MILLISEC 29 173 #define DTK_MICROSEC 30 174 #define DTK_JULIAN 31 178 #define DTK_TZ_HOUR 34 179 #define DTK_TZ_MINUTE 35 180 #define DTK_ISOYEAR 36 181 #define DTK_ISODOW 37 188 #define DTK_M(t) (0x01 << (t)) 191 #define DTK_ALL_SECS_M (DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND)) 192 #define DTK_DATE_M (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY)) 193 #define DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_ALL_SECS_M) 201 #define MAXDATELEN 128 203 #define MAXDATEFIELDS 25 238 #define FMODULO(t,q,u) \ 240 (q) = (((t) < 0) ? ceil((t) / (u)) : floor((t) / (u))); \ 241 if ((q) != 0) (t) -= rint((q) * (u)); \ 249 #define TMODULO(t,q,u) \ 252 if ((q) != 0) (t) -= ((q) * (u)); \ 260 extern const char *
const months[];
261 extern const char *
const days[];
262 extern const int day_tab[2][13];
271 #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) 280 #define DTERR_BAD_FORMAT (-1) 281 #define DTERR_FIELD_OVERFLOW (-2) 282 #define DTERR_MD_FIELD_OVERFLOW (-3) 283 #define DTERR_INTERVAL_OVERFLOW (-4) 284 #define DTERR_TZDISP_OVERFLOW (-5) 289 extern void j2date(
int jd,
int *year,
int *month,
int *day);
290 extern int date2j(
int year,
int month,
int day);
292 extern int ParseDateTime(
const char *timestr,
char *workbuf,
size_t buflen,
293 char **field,
int *ftype,
294 int maxfields,
int *numfields);
313 pg_tz *tzp,
int *isdst);
321 extern int ValidateDate(
int fmask,
bool isjulian,
bool is2digits,
bool bc,
325 int *offset,
pg_tz **tz);
329 extern int j2day(
int jd);
int DecodeISO8601Interval(char *str, int *dtype, struct pg_tm *tm, fsec_t *fsec)
#define pg_attribute_noreturn()
int DetermineTimeZoneOffset(struct pg_tm *tm, pg_tz *tzp)
void GetCurrentDateTime(struct pg_tm *tm)
void EncodeInterval(struct pg_tm *tm, fsec_t fsec, int style, char *str)
Node * TemporalSimplify(int32 max_precis, Node *node)
void EncodeDateOnly(struct pg_tm *tm, int style, char *str)
#define FLEXIBLE_ARRAY_MEMBER
int DecodeTimeOnly(char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp)
void AdjustTimestampForTypmod(Timestamp *time, int32 typmod)
void EncodeTimeOnly(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, int style, char *str)
int DecodeDateTime(char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp)
const char *const months[]
void EncodeSpecialTimestamp(Timestamp dt, char *str)
int date2j(int year, int month, int day)
int ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc, struct pg_tm *tm)
datetkn abbrevs[FLEXIBLE_ARRAY_MEMBER]
void j2date(int jd, int *year, int *month, int *day)
TimeZoneAbbrevTable * ConvertTimeZoneAbbrevs(struct tzEntry *abbrevs, int n)
int DecodeUnits(int field, char *lowtoken, int *val)
int DecodeTimezoneAbbrev(int field, char *lowtoken, int *offset, pg_tz **tz)
void GetCurrentTimeUsec(struct pg_tm *tm, fsec_t *fsec, int *tzp)
int ParseDateTime(const char *timestr, char *workbuf, size_t buflen, char **field, int *ftype, int maxfields, int *numfields)
int DetermineTimeZoneAbbrevOffsetTS(TimestampTz ts, const char *abbr, pg_tz *tzp, int *isdst)
static struct cvec * range(struct vars *v, chr a, chr b, int cases)
void DateTimeParseError(int dterr, const char *str, const char *datatype) pg_attribute_noreturn()
int DecodeSpecial(int field, char *lowtoken, int *val)
struct DynamicZoneAbbrev DynamicZoneAbbrev
int DecodeTimezone(char *str, int *tzp)
void InstallTimeZoneAbbrevs(TimeZoneAbbrevTable *tbl)
int DecodeInterval(char **field, int *ftype, int nf, int range, int *dtype, struct pg_tm *tm, fsec_t *fsec)
int DetermineTimeZoneAbbrevOffset(struct pg_tm *tm, const char *abbr, pg_tz *tzp)
struct TimeZoneAbbrevTable TimeZoneAbbrevTable
void EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str)
bool AdjustTimestampForTypmodError(Timestamp *time, int32 typmod, bool *error)
bool CheckDateTokenTables(void)