PostgreSQL Source Code
git master
|
#include "utils/timestamp.h"
Go to the source code of this file.
Data Structures | |
struct | datetkn |
struct | TimeZoneAbbrevTable |
struct | DynamicZoneAbbrev |
struct | DateTimeErrorExtra |
Macros | |
#define | DAGO "ago" |
#define | DCURRENT "current" |
#define | EPOCH "epoch" |
#define | INVALID "invalid" |
#define | EARLY "-infinity" |
#define | LATE "infinity" |
#define | NOW "now" |
#define | TODAY "today" |
#define | TOMORROW "tomorrow" |
#define | YESTERDAY "yesterday" |
#define | ZULU "zulu" |
#define | DMICROSEC "usecond" |
#define | DMILLISEC "msecond" |
#define | DSECOND "second" |
#define | DMINUTE "minute" |
#define | DHOUR "hour" |
#define | DDAY "day" |
#define | DWEEK "week" |
#define | DMONTH "month" |
#define | DQUARTER "quarter" |
#define | DYEAR "year" |
#define | DDECADE "decade" |
#define | DCENTURY "century" |
#define | DMILLENNIUM "millennium" |
#define | DA_D "ad" |
#define | DB_C "bc" |
#define | DTIMEZONE "timezone" |
#define | AM 0 |
#define | PM 1 |
#define | HR24 2 |
#define | AD 0 |
#define | BC 1 |
#define | RESERV 0 |
#define | MONTH 1 |
#define | YEAR 2 |
#define | DAY 3 |
#define | JULIAN 4 |
#define | TZ 5 /* fixed-offset timezone abbreviation */ |
#define | DTZ 6 /* fixed-offset timezone abbrev, DST */ |
#define | DYNTZ 7 /* dynamic timezone abbreviation */ |
#define | IGNORE_DTF 8 |
#define | AMPM 9 |
#define | HOUR 10 |
#define | MINUTE 11 |
#define | SECOND 12 |
#define | MILLISECOND 13 |
#define | MICROSECOND 14 |
#define | DOY 15 |
#define | DOW 16 |
#define | UNITS 17 |
#define | ADBC 18 |
#define | AGO 19 |
#define | ABS_BEFORE 20 |
#define | ABS_AFTER 21 |
#define | ISODATE 22 |
#define | ISOTIME 23 |
#define | WEEK 24 |
#define | DECADE 25 |
#define | CENTURY 26 |
#define | MILLENNIUM 27 |
#define | DTZMOD 28 /* "DST" as a separate word */ |
#define | UNKNOWN_FIELD 31 |
#define | DTK_NUMBER 0 |
#define | DTK_STRING 1 |
#define | DTK_DATE 2 |
#define | DTK_TIME 3 |
#define | DTK_TZ 4 |
#define | DTK_AGO 5 |
#define | DTK_SPECIAL 6 |
#define | DTK_EARLY 9 |
#define | DTK_LATE 10 |
#define | DTK_EPOCH 11 |
#define | DTK_NOW 12 |
#define | DTK_YESTERDAY 13 |
#define | DTK_TODAY 14 |
#define | DTK_TOMORROW 15 |
#define | DTK_ZULU 16 |
#define | DTK_DELTA 17 |
#define | DTK_SECOND 18 |
#define | DTK_MINUTE 19 |
#define | DTK_HOUR 20 |
#define | DTK_DAY 21 |
#define | DTK_WEEK 22 |
#define | DTK_MONTH 23 |
#define | DTK_QUARTER 24 |
#define | DTK_YEAR 25 |
#define | DTK_DECADE 26 |
#define | DTK_CENTURY 27 |
#define | DTK_MILLENNIUM 28 |
#define | DTK_MILLISEC 29 |
#define | DTK_MICROSEC 30 |
#define | DTK_JULIAN 31 |
#define | DTK_DOW 32 |
#define | DTK_DOY 33 |
#define | DTK_TZ_HOUR 34 |
#define | DTK_TZ_MINUTE 35 |
#define | DTK_ISOYEAR 36 |
#define | DTK_ISODOW 37 |
#define | DTK_M(t) (0x01 << (t)) |
#define | DTK_ALL_SECS_M (DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND)) |
#define | DTK_DATE_M (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY)) |
#define | DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_ALL_SECS_M) |
#define | MAXDATELEN 128 |
#define | MAXDATEFIELDS 25 |
#define | TOKMAXLEN 10 |
#define | FMODULO(t, q, u) |
#define | TMODULO(t, q, u) |
#define | isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) |
#define | DTERR_BAD_FORMAT (-1) |
#define | DTERR_FIELD_OVERFLOW (-2) |
#define | DTERR_MD_FIELD_OVERFLOW (-3) /* triggers hint about DateStyle */ |
#define | DTERR_INTERVAL_OVERFLOW (-4) |
#define | DTERR_TZDISP_OVERFLOW (-5) |
#define | DTERR_BAD_TIMEZONE (-6) |
#define | DTERR_BAD_ZONE_ABBREV (-7) |
#define | TZNAME_FIXED_OFFSET 0 |
#define | TZNAME_DYNTZ 1 |
#define | TZNAME_ZONE 2 |
Typedefs | |
typedef struct TimeZoneAbbrevTable | TimeZoneAbbrevTable |
typedef struct DynamicZoneAbbrev | DynamicZoneAbbrev |
typedef struct DateTimeErrorExtra | DateTimeErrorExtra |
Functions | |
void | GetCurrentDateTime (struct pg_tm *tm) |
void | GetCurrentTimeUsec (struct pg_tm *tm, fsec_t *fsec, int *tzp) |
void | j2date (int jd, int *year, int *month, int *day) |
int | date2j (int year, int month, int day) |
int | ParseDateTime (const char *timestr, char *workbuf, size_t buflen, char **field, int *ftype, int maxfields, int *numfields) |
int | DecodeDateTime (char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp, DateTimeErrorExtra *extra) |
int | DecodeTimezone (const char *str, int *tzp) |
int | DecodeTimeOnly (char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp, DateTimeErrorExtra *extra) |
int | DecodeInterval (char **field, int *ftype, int nf, int range, int *dtype, struct pg_itm_in *itm_in) |
int | DecodeISO8601Interval (char *str, int *dtype, struct pg_itm_in *itm_in) |
void | DateTimeParseError (int dterr, DateTimeErrorExtra *extra, const char *str, const char *datatype, struct Node *escontext) |
int | DetermineTimeZoneOffset (struct pg_tm *tm, pg_tz *tzp) |
int | DetermineTimeZoneAbbrevOffset (struct pg_tm *tm, const char *abbr, pg_tz *tzp) |
int | DetermineTimeZoneAbbrevOffsetTS (TimestampTz ts, const char *abbr, pg_tz *tzp, int *isdst) |
void | EncodeDateOnly (struct pg_tm *tm, int style, char *str) |
void | EncodeTimeOnly (struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, int style, char *str) |
void | EncodeDateTime (struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str) |
void | EncodeInterval (struct pg_itm *itm, int style, char *str) |
void | EncodeSpecialTimestamp (Timestamp dt, char *str) |
int | ValidateDate (int fmask, bool isjulian, bool is2digits, bool bc, struct pg_tm *tm) |
int | DecodeTimezoneAbbrev (int field, const char *lowtoken, int *ftype, int *offset, pg_tz **tz, DateTimeErrorExtra *extra) |
int | DecodeSpecial (int field, const char *lowtoken, int *val) |
int | DecodeUnits (int field, const char *lowtoken, int *val) |
int | DecodeTimezoneName (const char *tzname, int *offset, pg_tz **tz) |
pg_tz * | DecodeTimezoneNameToTz (const char *tzname) |
int | DecodeTimezoneAbbrevPrefix (const char *str, int *offset, pg_tz **tz) |
int | j2day (int date) |
struct Node * | TemporalSimplify (int32 max_precis, struct Node *node) |
bool | CheckDateTokenTables (void) |
TimeZoneAbbrevTable * | ConvertTimeZoneAbbrevs (struct tzEntry *abbrevs, int n) |
void | InstallTimeZoneAbbrevs (TimeZoneAbbrevTable *tbl) |
bool | AdjustTimestampForTypmod (Timestamp *time, int32 typmod, struct Node *escontext) |
Variables | |
PGDLLIMPORT const char *const | months [] |
PGDLLIMPORT const char *const | days [] |
PGDLLIMPORT const int | day_tab [2][13] |
#define ABS_AFTER 21 |
Definition at line 112 of file datetime.h.
#define ABS_BEFORE 20 |
Definition at line 111 of file datetime.h.
#define AD 0 |
Definition at line 75 of file datetime.h.
#define ADBC 18 |
Definition at line 108 of file datetime.h.
#define AGO 19 |
Definition at line 110 of file datetime.h.
#define AM 0 |
Definition at line 71 of file datetime.h.
#define AMPM 9 |
Definition at line 99 of file datetime.h.
#define BC 1 |
Definition at line 76 of file datetime.h.
#define CENTURY 26 |
Definition at line 119 of file datetime.h.
#define DA_D "ad" |
Definition at line 60 of file datetime.h.
#define DAGO "ago" |
Definition at line 35 of file datetime.h.
#define DAY 3 |
Definition at line 93 of file datetime.h.
#define DB_C "bc" |
Definition at line 61 of file datetime.h.
#define DCENTURY "century" |
Definition at line 58 of file datetime.h.
#define DCURRENT "current" |
Definition at line 36 of file datetime.h.
#define DDAY "day" |
Definition at line 52 of file datetime.h.
#define DDECADE "decade" |
Definition at line 57 of file datetime.h.
#define DECADE 25 |
Definition at line 118 of file datetime.h.
#define DHOUR "hour" |
Definition at line 51 of file datetime.h.
#define DMICROSEC "usecond" |
Definition at line 47 of file datetime.h.
#define DMILLENNIUM "millennium" |
Definition at line 59 of file datetime.h.
#define DMILLISEC "msecond" |
Definition at line 48 of file datetime.h.
#define DMINUTE "minute" |
Definition at line 50 of file datetime.h.
#define DMONTH "month" |
Definition at line 54 of file datetime.h.
#define DOW 16 |
Definition at line 106 of file datetime.h.
#define DOY 15 |
Definition at line 105 of file datetime.h.
#define DQUARTER "quarter" |
Definition at line 55 of file datetime.h.
#define DSECOND "second" |
Definition at line 49 of file datetime.h.
#define DTERR_BAD_FORMAT (-1) |
Definition at line 282 of file datetime.h.
#define DTERR_BAD_TIMEZONE (-6) |
Definition at line 287 of file datetime.h.
#define DTERR_BAD_ZONE_ABBREV (-7) |
Definition at line 288 of file datetime.h.
#define DTERR_FIELD_OVERFLOW (-2) |
Definition at line 283 of file datetime.h.
#define DTERR_INTERVAL_OVERFLOW (-4) |
Definition at line 285 of file datetime.h.
#define DTERR_MD_FIELD_OVERFLOW (-3) /* triggers hint about DateStyle */ |
Definition at line 284 of file datetime.h.
#define DTERR_TZDISP_OVERFLOW (-5) |
Definition at line 286 of file datetime.h.
#define DTIMEZONE "timezone" |
Definition at line 62 of file datetime.h.
#define DTK_AGO 5 |
Definition at line 147 of file datetime.h.
#define DTK_ALL_SECS_M (DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND)) |
Definition at line 190 of file datetime.h.
#define DTK_CENTURY 27 |
Definition at line 169 of file datetime.h.
#define DTK_DATE 2 |
Definition at line 144 of file datetime.h.
Definition at line 191 of file datetime.h.
#define DTK_DAY 21 |
Definition at line 163 of file datetime.h.
#define DTK_DECADE 26 |
Definition at line 168 of file datetime.h.
#define DTK_DELTA 17 |
Definition at line 159 of file datetime.h.
#define DTK_DOW 32 |
Definition at line 175 of file datetime.h.
#define DTK_DOY 33 |
Definition at line 176 of file datetime.h.
#define DTK_EARLY 9 |
Definition at line 150 of file datetime.h.
#define DTK_EPOCH 11 |
Definition at line 152 of file datetime.h.
#define DTK_HOUR 20 |
Definition at line 162 of file datetime.h.
#define DTK_ISODOW 37 |
Definition at line 180 of file datetime.h.
#define DTK_ISOYEAR 36 |
Definition at line 179 of file datetime.h.
#define DTK_JULIAN 31 |
Definition at line 173 of file datetime.h.
#define DTK_LATE 10 |
Definition at line 151 of file datetime.h.
#define DTK_M | ( | t | ) | (0x01 << (t)) |
Definition at line 187 of file datetime.h.
#define DTK_MICROSEC 30 |
Definition at line 172 of file datetime.h.
#define DTK_MILLENNIUM 28 |
Definition at line 170 of file datetime.h.
#define DTK_MILLISEC 29 |
Definition at line 171 of file datetime.h.
#define DTK_MINUTE 19 |
Definition at line 161 of file datetime.h.
#define DTK_MONTH 23 |
Definition at line 165 of file datetime.h.
#define DTK_NOW 12 |
Definition at line 153 of file datetime.h.
#define DTK_NUMBER 0 |
Definition at line 141 of file datetime.h.
#define DTK_QUARTER 24 |
Definition at line 166 of file datetime.h.
#define DTK_SECOND 18 |
Definition at line 160 of file datetime.h.
#define DTK_SPECIAL 6 |
Definition at line 149 of file datetime.h.
#define DTK_STRING 1 |
Definition at line 142 of file datetime.h.
#define DTK_TIME 3 |
Definition at line 145 of file datetime.h.
#define DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_ALL_SECS_M) |
Definition at line 192 of file datetime.h.
#define DTK_TODAY 14 |
Definition at line 155 of file datetime.h.
#define DTK_TOMORROW 15 |
Definition at line 156 of file datetime.h.
#define DTK_TZ 4 |
Definition at line 146 of file datetime.h.
#define DTK_TZ_HOUR 34 |
Definition at line 177 of file datetime.h.
#define DTK_TZ_MINUTE 35 |
Definition at line 178 of file datetime.h.
#define DTK_WEEK 22 |
Definition at line 164 of file datetime.h.
#define DTK_YEAR 25 |
Definition at line 167 of file datetime.h.
#define DTK_YESTERDAY 13 |
Definition at line 154 of file datetime.h.
#define DTK_ZULU 16 |
Definition at line 157 of file datetime.h.
#define DTZ 6 /* fixed-offset timezone abbrev, DST */ |
Definition at line 96 of file datetime.h.
Definition at line 122 of file datetime.h.
#define DWEEK "week" |
Definition at line 53 of file datetime.h.
#define DYEAR "year" |
Definition at line 56 of file datetime.h.
#define DYNTZ 7 /* dynamic timezone abbreviation */ |
Definition at line 97 of file datetime.h.
#define EARLY "-infinity" |
Definition at line 39 of file datetime.h.
#define EPOCH "epoch" |
Definition at line 37 of file datetime.h.
#define FMODULO | ( | t, | |
q, | |||
u | |||
) |
Definition at line 237 of file datetime.h.
#define HOUR 10 |
Definition at line 100 of file datetime.h.
#define HR24 2 |
Definition at line 73 of file datetime.h.
#define IGNORE_DTF 8 |
Definition at line 98 of file datetime.h.
#define INVALID "invalid" |
Definition at line 38 of file datetime.h.
Definition at line 271 of file datetime.h.
#define ISODATE 22 |
Definition at line 114 of file datetime.h.
#define ISOTIME 23 |
Definition at line 115 of file datetime.h.
#define JULIAN 4 |
Definition at line 94 of file datetime.h.
#define LATE "infinity" |
Definition at line 40 of file datetime.h.
#define MAXDATEFIELDS 25 |
Definition at line 202 of file datetime.h.
#define MAXDATELEN 128 |
Definition at line 200 of file datetime.h.
#define MICROSECOND 14 |
Definition at line 104 of file datetime.h.
#define MILLENNIUM 27 |
Definition at line 120 of file datetime.h.
#define MILLISECOND 13 |
Definition at line 103 of file datetime.h.
#define MINUTE 11 |
Definition at line 101 of file datetime.h.
#define MONTH 1 |
Definition at line 91 of file datetime.h.
#define NOW "now" |
Definition at line 41 of file datetime.h.
#define PM 1 |
Definition at line 72 of file datetime.h.
#define RESERV 0 |
Definition at line 90 of file datetime.h.
#define SECOND 12 |
Definition at line 102 of file datetime.h.
#define TMODULO | ( | t, | |
q, | |||
u | |||
) |
Definition at line 248 of file datetime.h.
#define TODAY "today" |
Definition at line 42 of file datetime.h.
#define TOKMAXLEN 10 |
Definition at line 204 of file datetime.h.
#define TOMORROW "tomorrow" |
Definition at line 43 of file datetime.h.
#define TZ 5 /* fixed-offset timezone abbreviation */ |
Definition at line 95 of file datetime.h.
#define TZNAME_DYNTZ 1 |
Definition at line 300 of file datetime.h.
#define TZNAME_FIXED_OFFSET 0 |
Definition at line 299 of file datetime.h.
#define TZNAME_ZONE 2 |
Definition at line 301 of file datetime.h.
#define UNITS 17 |
Definition at line 107 of file datetime.h.
#define UNKNOWN_FIELD 31 |
Definition at line 124 of file datetime.h.
#define WEEK 24 |
Definition at line 117 of file datetime.h.
#define YEAR 2 |
Definition at line 92 of file datetime.h.
#define YESTERDAY "yesterday" |
Definition at line 44 of file datetime.h.
#define ZULU "zulu" |
Definition at line 45 of file datetime.h.
typedef struct DateTimeErrorExtra DateTimeErrorExtra |
typedef struct DynamicZoneAbbrev DynamicZoneAbbrev |
typedef struct TimeZoneAbbrevTable TimeZoneAbbrevTable |
Definition at line 367 of file timestamp.c.
References ereturn, errcode(), errmsg(), INT64CONST, MAX_TIMESTAMP_PRECISION, and TIMESTAMP_NOT_FINITE.
Referenced by executeDateTimeMethod(), GetSQLCurrentTimestamp(), GetSQLLocalTimestamp(), parse_datetime(), timestamp_in(), timestamp_recv(), timestamp_scale(), timestamptz_in(), timestamptz_recv(), timestamptz_scale(), and to_timestamp().
bool CheckDateTokenTables | ( | void | ) |
Definition at line 4811 of file datetime.c.
TimeZoneAbbrevTable* ConvertTimeZoneAbbrevs | ( | struct tzEntry * | abbrevs, |
int | n | ||
) |
Definition at line 4873 of file datetime.c.
References tzEntry::abbrev, TimeZoneAbbrevTable::abbrevs, Assert, CheckDateTokenTable(), DTZ, DYNTZ, guc_malloc(), i, tzEntry::is_dst, LOG, MAXALIGN, TimeZoneAbbrevTable::numabbrevs, tzEntry::offset, strlcpy(), TimeZoneAbbrevTable::tblsize, datetkn::token, TOKMAXLEN, datetkn::type, TZ, DynamicZoneAbbrev::tz, datetkn::value, DynamicZoneAbbrev::zone, and tzEntry::zone.
Referenced by load_tzoffsets().
int date2j | ( | int | year, |
int | month, | ||
int | day | ||
) |
Definition at line 286 of file datetime.c.
void DateTimeParseError | ( | int | dterr, |
DateTimeErrorExtra * | extra, | ||
const char * | str, | ||
const char * | datatype, | ||
struct Node * | escontext | ||
) |
Definition at line 4092 of file datetime.c.
References DateTimeErrorExtra::dtee_abbrev, DateTimeErrorExtra::dtee_timezone, DTERR_BAD_FORMAT, DTERR_BAD_TIMEZONE, DTERR_BAD_ZONE_ABBREV, DTERR_FIELD_OVERFLOW, DTERR_INTERVAL_OVERFLOW, DTERR_MD_FIELD_OVERFLOW, DTERR_TZDISP_OVERFLOW, errcode(), errdetail(), errhint(), errmsg(), errsave, and str.
Referenced by date_in(), DecodeTimezoneName(), do_to_timestamp(), interval_in(), pg_timezone_abbrevs(), time_in(), timestamp_in(), timestamptz_in(), and timetz_in().
int DecodeDateTime | ( | char ** | field, |
int * | ftype, | ||
int | nf, | ||
int * | dtype, | ||
struct pg_tm * | tm, | ||
fsec_t * | fsec, | ||
int * | tzp, | ||
DateTimeErrorExtra * | extra | ||
) |
Definition at line 978 of file datetime.c.
References ADBC, AM, AMPM, BC, date2j(), DAY, DecodeDate(), DecodeNumber(), DecodeNumberField(), DecodeSpecial(), DecodeTime(), DecodeTimezone(), DecodeTimezoneAbbrev(), DetermineTimeZoneAbbrevOffset(), DetermineTimeZoneOffset(), DOW, dt2time(), DateTimeErrorExtra::dtee_timezone, DTERR_BAD_FORMAT, DTERR_BAD_TIMEZONE, DTERR_FIELD_OVERFLOW, DTK_DATE, DTK_DATE_M, DTK_EARLY, DTK_EPOCH, DTK_JULIAN, DTK_LATE, DTK_M, DTK_NOW, DTK_NUMBER, DTK_SPECIAL, DTK_STRING, DTK_TIME, DTK_TIME_M, DTK_TODAY, DTK_TOMORROW, DTK_TZ, DTK_YESTERDAY, DTK_ZULU, DTZ, DTZMOD, DYNTZ, elog, ERROR, GetCurrentDateTime(), GetCurrentTimeUsec(), HOURS_PER_DAY, HR24, i, IGNORE_DTF, INTERVAL_FULL_RANGE, ISOTIME, j2date(), MONTH, ParseFraction(), pg_tzset(), PM, RESERV, session_timezone, strtoint(), time_overflows(), tm, pg_tm::tm_hour, pg_tm::tm_isdst, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_wday, pg_tm::tm_year, type, TZ, UNITS, UNKNOWN_FIELD, USECS_PER_DAY, val, ValidateDate(), and value.
Referenced by check_recovery_target_time(), date_in(), PGTYPESdate_from_asc(), PGTYPEStimestamp_from_asc(), timestamp_in(), and timestamptz_in().
int DecodeInterval | ( | char ** | field, |
int * | ftype, | ||
int | nf, | ||
int | range, | ||
int * | dtype, | ||
struct pg_itm_in * | itm_in | ||
) |
Definition at line 3364 of file datetime.c.
References AdjustDays(), AdjustFractDays(), AdjustFractMicroseconds(), AdjustFractYears(), AdjustMicroseconds(), AdjustMonths(), AdjustYears(), AGO, Assert, CENTURY, ClearPgItmIn(), DAY, DAYS_PER_MONTH, DECADE, DecodeSpecial(), DecodeTimeForInterval(), DecodeUnits(), DTERR_BAD_FORMAT, DTERR_FIELD_OVERFLOW, DTK_ALL_SECS_M, DTK_CENTURY, DTK_DATE, DTK_DATE_M, DTK_DAY, DTK_DECADE, DTK_DELTA, DTK_EARLY, DTK_HOUR, DTK_LATE, DTK_M, DTK_MICROSEC, DTK_MILLENNIUM, DTK_MILLISEC, DTK_MINUTE, DTK_MONTH, DTK_NUMBER, DTK_SECOND, DTK_SPECIAL, DTK_STRING, DTK_TIME, DTK_TIME_M, DTK_TZ, DTK_WEEK, DTK_YEAR, HOUR, i, IGNORE_DTF, INTERVAL_MASK, IntervalStyle, INTSTYLE_SQL_STANDARD, MICROSECOND, MILLENNIUM, MILLISECOND, MINUTE, MONTH, MONTHS_PER_YEAR, ParseFraction(), pg_add_s64_overflow(), PG_INT64_MIN, pg_mul_s64_overflow(), range(), RESERV, SECOND, strtoint(), pg_itm_in::tm_mday, pg_itm_in::tm_mon, pg_itm_in::tm_usec, pg_itm_in::tm_year, type, UNITS, UNKNOWN_FIELD, USECS_PER_DAY, USECS_PER_HOUR, USECS_PER_MINUTE, USECS_PER_SEC, val, WEEK, and YEAR.
Referenced by interval_in().
int DecodeISO8601Interval | ( | char * | str, |
int * | dtype, | ||
struct pg_itm_in * | itm_in | ||
) |
Definition at line 3829 of file datetime.c.
References AdjustDays(), AdjustFractDays(), AdjustFractMicroseconds(), AdjustFractYears(), AdjustMicroseconds(), AdjustMonths(), AdjustYears(), ClearPgItmIn(), DAYS_PER_MONTH, DTERR_BAD_FORMAT, DTERR_FIELD_OVERFLOW, DTK_DELTA, ISO8601IntegerWidth(), ParseISO8601Number(), str, USECS_PER_DAY, USECS_PER_HOUR, USECS_PER_MINUTE, USECS_PER_SEC, and val.
Referenced by interval_in().
int DecodeSpecial | ( | int | field, |
const char * | lowtoken, | ||
int * | val | ||
) |
Definition at line 3148 of file datetime.c.
References datebsearch(), datecache, datetktbl, szdatetktbl, datetkn::token, TOKMAXLEN, type, datetkn::type, UNKNOWN_FIELD, val, and datetkn::value.
Referenced by DecodeDate(), DecodeDateTime(), DecodeInterval(), DecodeTimeOnly(), extract_date(), interval_part_common(), time_part_common(), timestamp_part_common(), timestamptz_part_common(), and timetz_part_common().
int DecodeTimeOnly | ( | char ** | field, |
int * | ftype, | ||
int | nf, | ||
int * | dtype, | ||
struct pg_tm * | tm, | ||
fsec_t * | fsec, | ||
int * | tzp, | ||
DateTimeErrorExtra * | extra | ||
) |
Definition at line 1864 of file datetime.c.
References ADBC, AM, AMPM, BC, DecodeDate(), DecodeNumber(), DecodeNumberField(), DecodeSpecial(), DecodeTime(), DecodeTimezone(), DecodeTimezoneAbbrev(), DetermineTimeZoneAbbrevOffset(), DetermineTimeZoneOffset(), dt2time(), DateTimeErrorExtra::dtee_timezone, DTERR_BAD_FORMAT, DTERR_BAD_TIMEZONE, DTERR_FIELD_OVERFLOW, DTK_DATE, DTK_DATE_M, DTK_JULIAN, DTK_M, DTK_NOW, DTK_NUMBER, DTK_SPECIAL, DTK_STRING, DTK_TIME, DTK_TIME_M, DTK_TZ, DTK_ZULU, DTZ, DTZMOD, DYNTZ, GetCurrentDateTime(), GetCurrentTimeUsec(), HOURS_PER_DAY, HR24, i, IGNORE_DTF, INTERVAL_FULL_RANGE, ISOTIME, j2date(), ParseFraction(), pg_get_timezone_offset(), pg_tzset(), PM, RESERV, session_timezone, strtoint(), time_overflows(), tm, pg_tm::tm_hour, pg_tm::tm_isdst, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_year, type, TZ, UNITS, UNKNOWN_FIELD, USECS_PER_DAY, val, ValidateDate(), and value.
Referenced by time_in(), and timetz_in().
int DecodeTimezone | ( | const char * | str, |
int * | tzp | ||
) |
Definition at line 3007 of file datetime.c.
References DTERR_BAD_FORMAT, DTERR_TZDISP_OVERFLOW, MAX_TZDISP_HOUR, MINS_PER_HOUR, SECS_PER_MINUTE, str, and strtoint().
Referenced by DecodeDateTime(), DecodeTimeOnly(), and parse_sane_timezone().
int DecodeTimezoneAbbrev | ( | int | field, |
const char * | lowtoken, | ||
int * | ftype, | ||
int * | offset, | ||
pg_tz ** | tz, | ||
DateTimeErrorExtra * | extra | ||
) |
Definition at line 3091 of file datetime.c.
References abbrevcache, TimeZoneAbbrevTable::abbrevs, datebsearch(), DTERR_BAD_ZONE_ABBREV, DYNTZ, FetchDynamicTimeZone(), TimeZoneAbbrevTable::numabbrevs, datetkn::token, TOKMAXLEN, datetkn::type, UNKNOWN_FIELD, datetkn::value, and zoneabbrevtbl.
Referenced by DecodeDateTime(), DecodeTimeOnly(), and DecodeTimezoneName().
int DecodeTimezoneAbbrevPrefix | ( | const char * | str, |
int * | offset, | ||
pg_tz ** | tz | ||
) |
Definition at line 3273 of file datetime.c.
References TimeZoneAbbrevTable::abbrevs, datebsearch(), DYNTZ, FetchDynamicTimeZone(), len, TimeZoneAbbrevTable::numabbrevs, pg_tolower(), str, TOKMAXLEN, datetkn::type, datetkn::value, and zoneabbrevtbl.
Referenced by DCH_from_char().
int DecodeTimezoneName | ( | const char * | tzname, |
int * | offset, | ||
pg_tz ** | tz | ||
) |
Definition at line 3190 of file datetime.c.
References DateTimeParseError(), DecodeTimezoneAbbrev(), downcase_truncate_identifier(), DTZ, DYNTZ, ereport, errcode(), errmsg(), ERROR, pg_tzset(), type, TZ, TZNAME_DYNTZ, TZNAME_FIXED_OFFSET, and TZNAME_ZONE.
Referenced by DecodeTimezoneNameToTz(), parse_sane_timezone(), timestamp_zone(), timestamptz_zone(), and timetz_zone().
pg_tz* DecodeTimezoneNameToTz | ( | const char * | tzname | ) |
Definition at line 3245 of file datetime.c.
References DecodeTimezoneName(), pg_tzset_offset(), and TZNAME_FIXED_OFFSET.
Referenced by lookup_timezone().
int DecodeUnits | ( | int | field, |
const char * | lowtoken, | ||
int * | val | ||
) |
Definition at line 4047 of file datetime.c.
References datebsearch(), deltacache, deltatktbl, szdeltatktbl, datetkn::token, TOKMAXLEN, type, datetkn::type, UNKNOWN_FIELD, val, and datetkn::value.
Referenced by DecodeInterval(), extract_date(), interval_part_common(), interval_trunc(), time_part_common(), timestamp_part_common(), timestamp_trunc(), timestamptz_part_common(), timestamptz_trunc_internal(), and timetz_part_common().
Definition at line 1746 of file datetime.c.
References DetermineTimeZoneAbbrevOffsetInternal(), DetermineTimeZoneOffsetInternal(), tm, and pg_tm::tm_isdst.
Referenced by DecodeDateTime(), DecodeTimeOnly(), do_to_timestamp(), parse_sane_timezone(), and timestamp_zone().
int DetermineTimeZoneAbbrevOffsetTS | ( | TimestampTz | ts, |
const char * | abbr, | ||
pg_tz * | tzp, | ||
int * | isdst | ||
) |
Definition at line 1784 of file datetime.c.
References DetermineTimeZoneAbbrevOffsetInternal(), DetermineTimeZoneOffset(), ereport, errcode(), errmsg(), ERROR, timestamp2tm(), timestamptz_to_time_t(), tm, and pg_tm::tm_isdst.
Referenced by pg_timezone_abbrevs(), timestamptz_zone(), and timetz_zone().
Definition at line 1585 of file datetime.c.
References DetermineTimeZoneOffsetInternal(), and tm.
Referenced by date2timestamptz_opt_overflow(), DecodeDateTime(), DecodeTimeOnly(), DetermineTimeZoneAbbrevOffsetTS(), executeDateTimeMethod(), parse_sane_timezone(), time_timetz(), timestamp2timestamptz_opt_overflow(), timestamp_zone(), timestamptz_pl_interval_internal(), timestamptz_trunc_internal(), and to_timestamp().
void EncodeDateOnly | ( | struct pg_tm * | tm, |
int | style, | ||
char * | str | ||
) |
Definition at line 4227 of file datetime.c.
References Assert, DateOrder, DATEORDER_DMY, MONTHS_PER_YEAR, pg_ultostr_zeropad(), str, tm, pg_tm::tm_mday, pg_tm::tm_mon, pg_tm::tm_year, USE_GERMAN_DATES, USE_ISO_DATES, USE_POSTGRES_DATES, USE_SQL_DATES, and USE_XSD_DATES.
Referenced by date_out(), JsonEncodeDateTime(), map_sql_value_to_xml_value(), and PGTYPESdate_to_asc().
void EncodeDateTime | ( | struct pg_tm * | tm, |
fsec_t | fsec, | ||
bool | print_tz, | ||
int | tz, | ||
const char * | tzn, | ||
int | style, | ||
char * | str | ||
) |
Definition at line 4342 of file datetime.c.
References AppendTimestampSeconds(), Assert, date2j(), DateOrder, DATEORDER_DMY, days, EncodeTimezone(), j2day(), MAXTZLEN, months, MONTHS_PER_YEAR, pg_ultostr_zeropad(), sprintf, str, tm, pg_tm::tm_hour, pg_tm::tm_isdst, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_wday, pg_tm::tm_year, USE_GERMAN_DATES, USE_ISO_DATES, USE_POSTGRES_DATES, USE_SQL_DATES, and USE_XSD_DATES.
Referenced by JsonEncodeDateTime(), map_sql_value_to_xml_value(), PGTYPEStimestamp_to_asc(), timestamp_out(), timestamptz_out(), and timestamptz_to_str().
void EncodeInterval | ( | struct pg_itm * | itm, |
int | style, | ||
char * | str | ||
) |
Definition at line 4585 of file datetime.c.
References AddISO8601IntPart(), AddPostgresIntPart(), AddVerboseIntPart(), AppendSeconds(), INTSTYLE_ISO_8601, INTSTYLE_POSTGRES, INTSTYLE_POSTGRES_VERBOSE, INTSTYLE_SQL_STANDARD, MAX_INTERVAL_PRECISION, sprintf, str, pg_itm::tm_hour, pg_itm::tm_mday, pg_itm::tm_min, pg_itm::tm_mon, pg_itm::tm_sec, pg_itm::tm_usec, and pg_itm::tm_year.
Referenced by interval_out().
void EncodeSpecialTimestamp | ( | Timestamp | dt, |
char * | str | ||
) |
Definition at line 1586 of file timestamp.c.
References EARLY, elog, ERROR, LATE, str, TIMESTAMP_IS_NOBEGIN, and TIMESTAMP_IS_NOEND.
Referenced by JsonEncodeDateTime(), PGTYPEStimestamp_to_asc(), timestamp_out(), timestamptz_out(), and timestamptz_to_str().
void EncodeTimeOnly | ( | struct pg_tm * | tm, |
fsec_t | fsec, | ||
bool | print_tz, | ||
int | tz, | ||
int | style, | ||
char * | str | ||
) |
Definition at line 4312 of file datetime.c.
References AppendSeconds(), EncodeTimezone(), MAX_TIME_PRECISION, pg_ultostr_zeropad(), str, tm, pg_tm::tm_hour, pg_tm::tm_min, and pg_tm::tm_sec.
Referenced by JsonEncodeDateTime(), time_out(), and timetz_out().
void GetCurrentDateTime | ( | struct pg_tm * | tm | ) |
Definition at line 366 of file datetime.c.
References GetCurrentTimeUsec(), and tm.
Referenced by DecodeDateTime(), DecodeTimeOnly(), GetSQLCurrentDate(), PGTYPESdate_today(), PGTYPEStimestamp_current(), and time_timetz().
Definition at line 387 of file datetime.c.
References ereport, errcode(), errmsg(), ERROR, GetCurrentTransactionStartTimestamp(), session_timezone, timestamp2tm(), and tm.
Referenced by DecodeDateTime(), DecodeTimeOnly(), GetCurrentDateTime(), GetSQLCurrentTime(), and GetSQLLocalTime().
void InstallTimeZoneAbbrevs | ( | TimeZoneAbbrevTable * | tbl | ) |
Definition at line 4957 of file datetime.c.
References abbrevcache, and zoneabbrevtbl.
Referenced by assign_timezone_abbreviations().
void j2date | ( | int | jd, |
int * | year, | ||
int * | month, | ||
int * | day | ||
) |
Definition at line 311 of file datetime.c.
int j2day | ( | int | date | ) |
Definition at line 344 of file datetime.c.
Referenced by date2isoweek(), date2isoyear(), EncodeDateTime(), extract_date(), isoweek2j(), timestamp_part_common(), and timestamptz_part_common().
int ParseDateTime | ( | const char * | timestr, |
char * | workbuf, | ||
size_t | buflen, | ||
char ** | field, | ||
int * | ftype, | ||
int | maxfields, | ||
int * | numfields | ||
) |
Definition at line 754 of file datetime.c.
References APPEND_CHAR, datebsearch(), datetktbl, DTERR_BAD_FORMAT, DTK_DATE, DTK_NUMBER, DTK_SPECIAL, DTK_STRING, DTK_TIME, DTK_TZ, pg_tolower(), and szdatetktbl.
Referenced by check_recovery_target_time(), date_in(), interval_in(), PGTYPESdate_from_asc(), PGTYPESinterval_from_asc(), PGTYPEStimestamp_from_asc(), time_in(), timestamp_in(), timestamptz_in(), and timetz_in().
Definition at line 4840 of file datetime.c.
References FuncExpr::args, Assert, castNode, DatumGetInt32(), exprTypmod(), IsA, linitial, list_length(), lsecond, relabel_to_typmod(), and source.
Referenced by time_support(), and timestamp_support().
int ValidateDate | ( | int | fmask, |
bool | isjulian, | ||
bool | is2digits, | ||
bool | bc, | ||
struct pg_tm * | tm | ||
) |
Definition at line 2508 of file datetime.c.
References date2j(), DAY, day_tab, DOY, DTERR_FIELD_OVERFLOW, DTERR_MD_FIELD_OVERFLOW, DTK_DATE_M, DTK_M, isleap, j2date(), MONTH, MONTHS_PER_YEAR, tm, pg_tm::tm_mday, pg_tm::tm_mon, pg_tm::tm_yday, pg_tm::tm_year, and YEAR.
Referenced by DecodeDateTime(), DecodeTimeOnly(), do_to_timestamp(), make_date(), and make_timestamp_internal().
|
extern |
Definition at line 75 of file datetime.c.
|
extern |
Definition at line 84 of file datetime.c.
|
extern |
Definition at line 81 of file datetime.c.