|
PostgreSQL Source Code git master
|
#include "postgres_fe.h"#include <time.h>#include <ctype.h>#include <math.h>#include "common/string.h"#include "dt.h"#include "pgtypes_timestamp.h"#include "pgtypeslib_extern.h"
Go to the source code of this file.
Typedefs | |
| typedef long | AbsoluteTime |
Variables | |
| const int | day_tab [2][13] |
| static const datetkn | datetktbl [] |
| static const datetkn | deltatktbl [] |
| static const unsigned int | szdatetktbl = lengthof(datetktbl) |
| static const unsigned int | szdeltatktbl = lengthof(deltatktbl) |
| static const datetkn * | datecache [MAXDATEFIELDS] = {NULL} |
| static const datetkn * | deltacache [MAXDATEFIELDS] = {NULL} |
| char * | months [] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL} |
| char * | days [] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", NULL} |
| char * | pgtypes_date_weekdays_short [] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", NULL} |
| char * | pgtypes_date_months [] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", NULL} |
Definition at line 18 of file dt_common.c.
Definition at line 973 of file dt_common.c.
References fb(), MAXTZLEN, PGTYPES_TS_BAD_TIMESTAMP, SECS_PER_HOUR, strlcpy(), TIMEZONE_GLOBAL, tm, pg_tm::tm_gmtoff, 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, pg_tm::tm_zone, and TZNAME_GLOBAL.
Referenced by GetCurrentDateTime().
Definition at line 581 of file dt_common.c.
Referenced by DecodeDateTime(), DecodeNumber(), and EncodeDateTime().
|
static |
Definition at line 502 of file dt_common.c.
References fb(), and TOKMAXLEN.
Referenced by DecodeSpecial(), and DecodeUnits().
Definition at line 1308 of file dt_common.c.
References ADBC, BC, DecodeNumber(), DecodeSpecial(), DOY, DTK_DATE_M, DTK_M, fb(), i, IGNORE_DTF, len, MAXDATEFIELDS, MONTH, str, tm, pg_tm::tm_mon, pg_tm::tm_year, type, TZ, and val.
Referenced by DecodeDateTime().
| int DecodeDateTime | ( | char ** | field, |
| int * | ftype, | ||
| int | nf, | ||
| int * | dtype, | ||
| struct tm * | tm, | ||
| fsec_t * | fsec, | ||
| bool | EuroDates | ||
| ) |
Definition at line 1782 of file dt_common.c.
References ADBC, AM, AMPM, BC, date2j(), DAY, day_tab, DecodeDate(), DecodeNumber(), DecodeNumberField(), DecodePosixTimezone(), DecodeSpecial(), DecodeTime(), DecodeTimezone(), DOW, dt2time(), DTK_DATE, DTK_DATE_M, DTK_DAY, DTK_HOUR, DTK_JULIAN, DTK_M, DTK_MINUTE, DTK_MONTH, DTK_NOW, DTK_NUMBER, DTK_SECOND, DTK_SPECIAL, DTK_STRING, DTK_TIME, DTK_TIME_M, DTK_TODAY, DTK_TOMORROW, DTK_TZ, DTK_YEAR, DTK_YESTERDAY, DTK_ZULU, DTZ, DTZMOD, fb(), GetCurrentDateTime(), HOUR, HR24, i, IGNORE_DTF, isleap, ISOTIME, j2date(), MINUTE, MONTH, PM, RESERV, SECOND, strtoint(), 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, USECS_PER_DAY, val, value, and YEAR.
|
static |
Definition at line 1199 of file dt_common.c.
References date2j(), DAY, DecodeNumberField(), DOY, DTK_DATE_M, DTK_M, fb(), j2date(), MONTH, MONTHS_PER_YEAR, str, strtoint(), tm, pg_tm::tm_mday, pg_tm::tm_mon, pg_tm::tm_yday, pg_tm::tm_year, val, and YEAR.
Referenced by DecodeDate(), and DecodeDateTime().
|
static |
Definition at line 1089 of file dt_common.c.
References DTK_DATE, DTK_DATE_M, DTK_TIME, DTK_TIME_M, fb(), i, len, str, strtoint(), tm, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, and pg_tm::tm_year.
Referenced by DecodeDateTime(), and DecodeNumber().
Definition at line 1547 of file dt_common.c.
References DecodeSpecial(), DecodeTimezone(), DTZ, fb(), MAXDATEFIELDS, str, type, TZ, and val.
Referenced by DecodeDateTime().
Definition at line 635 of file dt_common.c.
References datebsearch(), datecache, datetktbl, fb(), szdatetktbl, TOKMAXLEN, type, datetkn::type, UNKNOWN_FIELD, val, and datetkn::value.
Referenced by DecodeDate(), DecodeDateTime(), and DecodePosixTimezone().
Definition at line 1437 of file dt_common.c.
References DTK_TIME_M, fb(), i, str, strtoint(), tm, pg_tm::tm_hour, pg_tm::tm_min, pg_tm::tm_sec, and USECS_PER_SEC.
Referenced by DecodeDateTime().
Definition at line 1502 of file dt_common.c.
References fb(), len, MINS_PER_HOUR, SECS_PER_MINUTE, str, and strtoint().
Referenced by DecodeDateTime(), DecodePosixTimezone(), and PGTYPEStimestamp_defmt_scan().
Definition at line 536 of file dt_common.c.
References datebsearch(), deltacache, deltatktbl, fb(), szdeltatktbl, TOKMAXLEN, type, datetkn::type, UNKNOWN_FIELD, val, and datetkn::value.
Definition at line 1068 of file dt_common.c.
References fb(), USECS_PER_HOUR, USECS_PER_MINUTE, and USECS_PER_SEC.
Referenced by DecodeDateTime().
Definition at line 669 of file dt_common.c.
References Assert, fb(), MONTHS_PER_YEAR, sprintf, str, tm, pg_tm::tm_mday, pg_tm::tm_mon, pg_tm::tm_year, USE_GERMAN_DATES, USE_ISO_DATES, USE_POSTGRES_DATES, and USE_SQL_DATES.
| void EncodeDateTime | ( | struct tm * | tm, |
| fsec_t | fsec, | ||
| bool | print_tz, | ||
| int | tz, | ||
| const char * | tzn, | ||
| int | style, | ||
| char * | str, | ||
| bool | EuroDates | ||
| ) |
Definition at line 753 of file dt_common.c.
References date2j(), days, fb(), MAXTZLEN, MINS_PER_HOUR, months, SECS_PER_HOUR, 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_sec, pg_tm::tm_wday, pg_tm::tm_year, TrimTrailingZeros(), USE_GERMAN_DATES, USE_ISO_DATES, USE_POSTGRES_DATES, and USE_SQL_DATES.
Definition at line 2354 of file dt_common.c.
Referenced by pgtypes_defmt_scan().
Definition at line 1060 of file dt_common.c.
References abstime2tm(), fb(), and tm.
Referenced by DecodeDateTime().
Definition at line 949 of file dt_common.c.
References epoch, fb(), tm, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, and pg_tm::tm_year.
Definition at line 606 of file dt_common.c.
Referenced by DecodeDateTime(), and DecodeNumber().
| int ParseDateTime | ( | char * | timestr, |
| char * | lowstr, | ||
| char ** | field, | ||
| int * | ftype, | ||
| int * | numfields, | ||
| char ** | endstr | ||
| ) |
Definition at line 1600 of file dt_common.c.
References DTK_DATE, DTK_NUMBER, DTK_SPECIAL, DTK_STRING, DTK_TIME, DTK_TZ, fb(), MAXDATEFIELDS, and pg_tolower().
|
static |
Definition at line 2459 of file dt_common.c.
References err(), fb(), find_end_token(), pgtypes_strdup(), PGTYPES_TYPE_STRING_MALLOCED, PGTYPES_TYPE_UINT, and PGTYPES_TYPE_UINT_LONG.
Referenced by PGTYPEStimestamp_defmt_scan().
| int PGTYPEStimestamp_defmt_scan | ( | char ** | str, |
| char * | fmt, | ||
| timestamp * | d, | ||
| int * | year, | ||
| int * | month, | ||
| int * | day, | ||
| int * | hour, | ||
| int * | minute, | ||
| int * | second, | ||
| int * | tz | ||
| ) |
Definition at line 2521 of file dt_common.c.
References datetktbl, day_tab, days, DecodeTimezone(), DTZ, err(), fb(), free, isleap, j, months, MONTHS_PER_YEAR, pg_strcasecmp(), pgtypes_alloc(), pgtypes_date_months, pgtypes_date_weekdays_short, pgtypes_defmt_scan(), PGTYPES_TYPE_STRING_MALLOCED, PGTYPES_TYPE_UINT, PGTYPES_TYPE_UINT_LONG, PGTYPEStimestamp_defmt_scan(), str, szdatetktbl, tm, tm2timestamp(), pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_year, type, TZ, and datetkn::value.
Referenced by PGTYPEStimestamp_defmt_asc(), and PGTYPEStimestamp_defmt_scan().
Definition at line 722 of file dt_common.c.
References fb(), len, and str.
Referenced by AppendSeconds(), and EncodeDateTime().
|
static |
Definition at line 20 of file dt_common.c.
Referenced by DecodeSpecial(), and PGTYPEStimestamp_defmt_scan().
Definition at line 14 of file dt_common.c.
Referenced by DecodeDateTime(), and PGTYPEStimestamp_defmt_scan().
Definition at line 495 of file dt_common.c.
Referenced by EncodeDateTime(), and PGTYPEStimestamp_defmt_scan().
|
static |
Definition at line 421 of file dt_common.c.
Referenced by DecodeUnits().
| char* months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL} |
Definition at line 493 of file dt_common.c.
Referenced by EncodeDateTime(), and PGTYPEStimestamp_defmt_scan().
| char* pgtypes_date_months[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", NULL} |
Definition at line 499 of file dt_common.c.
Referenced by dttofmtasc_replace(), PGTYPESdate_defmt_asc(), and PGTYPEStimestamp_defmt_scan().
Definition at line 497 of file dt_common.c.
Referenced by dttofmtasc_replace(), PGTYPESdate_fmt_asc(), and PGTYPEStimestamp_defmt_scan().
Definition at line 486 of file dt_common.c.
Referenced by DecodeSpecial(), and PGTYPEStimestamp_defmt_scan().
|
static |
Definition at line 487 of file dt_common.c.
Referenced by DecodeUnits().