11 #error -ffast-math is known to break this code
21 time2t(
const int hour,
const int min,
const int sec,
const fsec_t fsec)
56 *result =
dt2local(*result, -(*tzp));
97 #if defined(HAVE_STRUCT_TM_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
102 date0 =
date2j(2000, 1, 1);
107 if (time < INT64CONST(0))
117 if (dDate < 0 || dDate > (
timestamp) INT_MAX)
131 #if defined(HAVE_STRUCT_TM_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
135 ((date0 -
date2j(1970, 1, 1)) * INT64CONST(86400));
137 tx = localtime_r(&utime, &tmbuf);
145 #if defined(HAVE_STRUCT_TM_TM_ZONE)
152 #elif defined(HAVE_INT_TIMEZONE)
215 char **ptr = (endptr != NULL) ? endptr : &realptr;
400 i = strftime(q, *pstr_len, tmp,
tm);
420 const char *
fmt =
"%G";
423 i = strftime(q, *pstr_len,
fmt,
tm);
442 const char *
fmt =
"%g";
446 i = strftime(q, *pstr_len,
fmt,
tm);
582 i = strftime(q, *pstr_len,
"%U",
tm);
601 const char *
fmt =
"%V";
603 i = strftime(q, *pstr_len,
fmt,
tm);
626 i = strftime(q, *pstr_len,
"%U",
tm);
644 const char *
fmt =
"%x";
648 i = strftime(q, *pstr_len,
fmt,
tm);
667 i = strftime(q, *pstr_len,
"%X",
tm);
691 i = strftime(q, *pstr_len,
"%z",
tm);
705 i = strftime(q, *pstr_len,
"%Z",
tm);
798 iv->
time = (*ts1 - *ts2);
821 fmt =
"%Y-%m-%d %H:%M:%S";
864 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[]
static bool pg_mul_s64_overflow(int64 a, int64 b, int64 *result)
static bool pg_add_s64_overflow(int64 a, int64 b, int64 *result)
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)