PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <time.h>
#include <limits.h>
#include <math.h>
#include "common/int.h"
#include "dt.h"
#include "pgtypes_date.h"
#include "pgtypes_timestamp.h"
#include "pgtypeslib_extern.h"
Go to the source code of this file.
Functions | |
static int64 | time2t (const int hour, const int min, const int sec, const fsec_t fsec) |
static timestamp | dt2local (timestamp dt, int tz) |
int | tm2timestamp (struct tm *tm, fsec_t fsec, int *tzp, timestamp *result) |
static timestamp | SetEpochTimestamp (void) |
static int | timestamp2tm (timestamp dt, int *tzp, struct tm *tm, fsec_t *fsec, const char **tzn) |
static void | EncodeSpecialTimestamp (timestamp dt, char *str) |
timestamp | PGTYPEStimestamp_from_asc (char *str, char **endptr) |
char * | PGTYPEStimestamp_to_asc (timestamp tstamp) |
void | PGTYPEStimestamp_current (timestamp *ts) |
static int | dttofmtasc_replace (timestamp *ts, date dDate, int dow, struct tm *tm, char *output, int *pstr_len, const char *fmtstr) |
int | PGTYPEStimestamp_fmt_asc (timestamp *ts, char *output, int str_len, const char *fmtstr) |
int | PGTYPEStimestamp_sub (timestamp *ts1, timestamp *ts2, interval *iv) |
int | PGTYPEStimestamp_defmt_asc (const char *str, const char *fmt, timestamp *d) |
int | PGTYPEStimestamp_add_interval (timestamp *tin, interval *span, timestamp *tout) |
int | PGTYPEStimestamp_sub_interval (timestamp *tin, interval *span, timestamp *tout) |
|
static |
Definition at line 300 of file timestamp.c.
References un_fmt_comb::char_val, days, fmt, fmtstr(), i, un_fmt_comb::int64_val, months, output, pgtypes_date_months, pgtypes_date_weekdays_short, pgtypes_fmt_replace(), PGTYPES_TYPE_CHAR, PGTYPES_TYPE_INT64, PGTYPES_TYPE_NOTHING, PGTYPES_TYPE_STRING_CONSTANT, PGTYPES_TYPE_UINT, PGTYPES_TYPE_UINT_2_LS, PGTYPES_TYPE_UINT_2_LZ, PGTYPES_TYPE_UINT_3_LZ, SetEpochTimestamp(), un_fmt_comb::str_val, tm, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_yday, pg_tm::tm_year, and un_fmt_comb::uint_val.
Referenced by PGTYPEStimestamp_fmt_asc().
|
static |
Definition at line 191 of file timestamp.c.
References EARLY, LATE, str, TIMESTAMP_IS_NOBEGIN, and TIMESTAMP_IS_NOEND.
Definition at line 858 of file timestamp.c.
References day_tab, isleap, interval::month, MONTHS_PER_YEAR, interval::time, timestamp2tm(), TIMESTAMP_NOT_FINITE, tm, tm2timestamp(), pg_tm::tm_mday, pg_tm::tm_mon, and pg_tm::tm_year.
Referenced by main(), and PGTYPEStimestamp_sub_interval().
void PGTYPEStimestamp_current | ( | timestamp * | ts | ) |
Definition at line 290 of file timestamp.c.
References GetCurrentDateTime(), tm, and tm2timestamp().
Referenced by dtcurrent(), and main().
int PGTYPEStimestamp_defmt_asc | ( | const char * | str, |
const char * | fmt, | ||
timestamp * | d | ||
) |
Definition at line 806 of file timestamp.c.
References fmt, free, i, pgtypes_strdup(), PGTYPEStimestamp_defmt_scan(), and str.
Referenced by dtcvfmtasc(), and main().
int PGTYPEStimestamp_fmt_asc | ( | timestamp * | ts, |
char * | output, | ||
int | str_len, | ||
const char * | fmtstr | ||
) |
Definition at line 778 of file timestamp.c.
References dttofmtasc_replace(), fmtstr(), output, PGTYPESdate_dayofweek(), PGTYPESdate_from_timestamp(), timestamp2tm(), and tm.
Referenced by dttofmtasc(), and main().
timestamp PGTYPEStimestamp_from_asc | ( | char * | str, |
char ** | endptr | ||
) |
Definition at line 202 of file timestamp.c.
References DecodeDateTime(), DTK_DATE, DTK_EARLY, DTK_EPOCH, DTK_LATE, MAXDATEFIELDS, MAXDATELEN, ParseDateTime(), PGTYPES_TS_BAD_TIMESTAMP, SetEpochTimestamp(), str, TIMESTAMP_NOBEGIN, TIMESTAMP_NOEND, tm, and tm2timestamp().
Referenced by dtcvasc(), ecpg_get_data(), and main().
Definition at line 793 of file timestamp.c.
References interval::month, PGTYPES_TS_ERR_EINFTIME, interval::time, and TIMESTAMP_NOT_FINITE.
Referenced by dtsub().
Definition at line 913 of file timestamp.c.
References interval::month, PGTYPEStimestamp_add_interval(), and interval::time.
char* PGTYPEStimestamp_to_asc | ( | timestamp | tstamp | ) |
Definition at line 268 of file timestamp.c.
References buf, DateStyle, EncodeDateTime(), EncodeSpecialTimestamp(), MAXDATELEN, pgtypes_strdup(), PGTYPES_TS_BAD_TIMESTAMP, timestamp2tm(), TIMESTAMP_NOT_FINITE, and tm.
Referenced by dttoasc(), ecpg_store_input(), and main().
|
static |
|
static |
Definition at line 21 of file timestamp.c.
References MINS_PER_HOUR, SECS_PER_MINUTE, and USECS_PER_SEC.
Referenced by tm2timestamp().
|
static |
Definition at line 92 of file timestamp.c.
References date2j(), dt2time(), IS_VALID_UTIME, j2date(), SECS_PER_HOUR, 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_yday, pg_tm::tm_year, pg_tm::tm_zone, TMODULO, TZNAME_GLOBAL, USECS_PER_DAY, and USECS_PER_SEC.
Definition at line 41 of file timestamp.c.
References date2j(), dt2local(), IS_VALID_JULIAN, IS_VALID_TIMESTAMP, pg_add_s64_overflow(), pg_mul_s64_overflow(), time2t(), tm, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_year, unlikely, and USECS_PER_DAY.