11 #error -ffast-math is known to break this code
20 time2t(
const int hour,
const int min,
const int sec,
const fsec_t fsec)
57 if ((*result < 0 && dDate > 0) ||
58 (*result > 0 && dDate < -1))
61 *result =
dt2local(*result, -(*tzp));
102 #if defined(HAVE_STRUCT_TM_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
107 date0 =
date2j(2000, 1, 1);
112 if (time < INT64CONST(0))
122 if (dDate < 0 || dDate > (
timestamp) INT_MAX)
136 #if defined(HAVE_STRUCT_TM_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
139 ((date0 -
date2j(1970, 1, 1)) * INT64CONST(86400));
141 tx = localtime(&utime);
149 #if defined(HAVE_STRUCT_TM_TM_ZONE)
156 #elif defined(HAVE_INT_TIMEZONE)
219 char **ptr = (endptr != NULL) ? endptr : &realptr;
404 i = strftime(q, *pstr_len, tmp,
tm);
424 const char *
fmt =
"%G";
427 i = strftime(q, *pstr_len,
fmt,
tm);
446 const char *
fmt =
"%g";
450 i = strftime(q, *pstr_len,
fmt,
tm);
586 i = strftime(q, *pstr_len,
"%U",
tm);
605 const char *
fmt =
"%V";
607 i = strftime(q, *pstr_len,
fmt,
tm);
630 i = strftime(q, *pstr_len,
"%U",
tm);
648 const char *
fmt =
"%x";
652 i = strftime(q, *pstr_len,
fmt,
tm);
671 i = strftime(q, *pstr_len,
"%X",
tm);
695 i = strftime(q, *pstr_len,
"%z",
tm);
709 i = strftime(q, *pstr_len,
"%Z",
tm);
802 iv->
time = (*ts1 - *ts2);
825 fmt =
"%Y-%m-%d %H:%M:%S";
868 if (span->
month != 0)
int ParseDateTime(const char *timestr, char *workbuf, size_t buflen, char **field, int *ftype, int maxfields, int *numfields)
void j2date(int jd, int *year, int *month, int *day)
void GetCurrentDateTime(struct pg_tm *tm)
void EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str)
const char *const months[]
int DecodeDateTime(char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp, DateTimeErrorExtra *extra)
int date2j(int year, int month, int day)
void dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec)
void GetEpochTime(struct pg_tm *tm)
Timestamp SetEpochTimestamp(void)
int tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result)
void EncodeSpecialTimestamp(Timestamp dt, char *str)
int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone)
#define TIMESTAMP_NOBEGIN(j)
#define IS_VALID_JULIAN(y, m, d)
#define IS_VALID_TIMESTAMP(t)
#define TIMESTAMP_IS_NOEND(j)
#define TIMESTAMP_IS_NOBEGIN(j)
#define TIMESTAMP_NOT_FINITE(j)
#define TIMESTAMP_NOEND(j)
int PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp *d, int *year, int *month, int *day, int *hour, int *minute, int *second, int *tz)
#define IS_VALID_UTIME(y, m, d)
char * pgtypes_date_months[]
char * pgtypes_date_weekdays_short[]
char * pgtypes_strdup(const char *str)
int pgtypes_fmt_replace(union un_fmt_comb replace_val, int replace_type, char **output, int *pstr_len)
int PGTYPEStimestamp_sub_interval(timestamp *tin, interval *span, timestamp *tout)
timestamp PGTYPEStimestamp_from_asc(char *str, char **endptr)
static timestamp dt2local(timestamp dt, int tz)
int PGTYPEStimestamp_sub(timestamp *ts1, timestamp *ts2, interval *iv)
static int64 time2t(const int hour, const int min, const int sec, const fsec_t fsec)
int PGTYPEStimestamp_add_interval(timestamp *tin, interval *span, timestamp *tout)
void PGTYPEStimestamp_current(timestamp *ts)
char * PGTYPEStimestamp_to_asc(timestamp tstamp)
int PGTYPEStimestamp_fmt_asc(timestamp *ts, char *output, int str_len, const char *fmtstr)
int PGTYPEStimestamp_defmt_asc(const char *str, const char *fmt, timestamp *d)
static int dttofmtasc_replace(timestamp *ts, date dDate, int dow, struct tm *tm, char *output, int *pstr_len, const char *fmtstr)
static void const char * fmt
date PGTYPESdate_from_timestamp(timestamp dt)
int PGTYPESdate_dayofweek(date dDate)
#define PGTYPES_TS_BAD_TIMESTAMP
#define PGTYPES_TS_ERR_EINFTIME
#define PGTYPES_TYPE_STRING_CONSTANT
#define PGTYPES_TYPE_NOTHING
#define PGTYPES_TYPE_UINT
#define PGTYPES_TYPE_CHAR
#define PGTYPES_TYPE_UINT_2_LS
#define PGTYPES_TYPE_UINT_2_LZ
#define PGTYPES_TYPE_INT64
#define PGTYPES_TYPE_UINT_3_LZ
static void fmtstr(const char *value, int leftjust, int minlen, int maxwidth, int pointflag, PrintfTarget *target)