PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <sys/time.h>
#include "access/xact.h"
#include "catalog/pg_type.h"
#include "common/int128.h"
#include "funcapi.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "nodes/supportnodes.h"
#include "parser/scansup.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/date.h"
#include "utils/datetime.h"
#include "utils/float.h"
Go to the source code of this file.
Data Structures | |
struct | generate_series_timestamp_fctx |
struct | generate_series_timestamptz_fctx |
Macros | |
#define | SAMESIGN(a, b) (((a) < 0) == ((b) < 0)) |
#define | TIMESTAMP_GT(t1, t2) DatumGetBool(DirectFunctionCall2(timestamp_gt,t1,t2)) |
#define | TIMESTAMP_LT(t1, t2) DatumGetBool(DirectFunctionCall2(timestamp_lt,t1,t2)) |
Variables | |
TimestampTz | PgStartTime |
TimestampTz | PgReloadTime |
#define SAMESIGN | ( | a, | |
b | |||
) | (((a) < 0) == ((b) < 0)) |
Definition at line 47 of file timestamp.c.
Referenced by interval2tm(), interval_mi(), interval_pl(), and interval_um().
#define TIMESTAMP_GT | ( | t1, | |
t2 | |||
) | DatumGetBool(DirectFunctionCall2(timestamp_gt,t1,t2)) |
Referenced by overlaps_timestamp().
#define TIMESTAMP_LT | ( | t1, | |
t2 | |||
) | DatumGetBool(DirectFunctionCall2(timestamp_lt,t1,t2)) |
Referenced by overlaps_timestamp().
Definition at line 1328 of file timestamp.c.
References Interval::day, DAY, elog, ereport, errcode(), errmsg(), ERROR, HOUR, INTERVAL_FULL_PRECISION, INTERVAL_FULL_RANGE, INTERVAL_MASK, INTERVAL_PRECISION, INTERVAL_RANGE, MAX_INTERVAL_PRECISION, MINUTE, Interval::month, MONTH, MONTHS_PER_YEAR, range(), SECOND, Interval::time, USECS_PER_HOUR, USECS_PER_MINUTE, and YEAR.
Referenced by interval_in(), interval_recv(), and interval_scale().
Definition at line 392 of file timestamp.c.
References AdjustTimestampForTypmodError().
Referenced by GetSQLCurrentTimestamp(), GetSQLLocalTimestamp(), parse_datetime(), timestamp_in(), timestamp_recv(), timestamp_scale(), timestamptz_in(), timestamptz_recv(), timestamptz_scale(), and to_timestamp().
Definition at line 337 of file timestamp.c.
References ereport, errcode(), errmsg(), ERROR, MAX_TIMESTAMP_PRECISION, and TIMESTAMP_NOT_FINITE.
Referenced by AdjustTimestampForTypmod().
Definition at line 102 of file timestamp.c.
References ereport, errcode(), errmsg(), ERROR, MAX_TIMESTAMP_PRECISION, and WARNING.
Referenced by anytimestamp_typmodin(), and transformSQLValueFunction().
Definition at line 81 of file timestamp.c.
References anytimestamp_typmod_check(), ArrayGetIntegerTypmods(), ereport, errcode(), errmsg(), and ERROR.
Referenced by timestamptypmodin(), and timestamptztypmodin().
Definition at line 124 of file timestamp.c.
References psprintf().
Referenced by timestamptypmodout(), and timestamptztypmodout().
Datum clock_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1554 of file timestamp.c.
References GetCurrentTimestamp(), and PG_RETURN_TIMESTAMPTZ.
int date2isoweek | ( | int | year, |
int | mon, | ||
int | mday | ||
) |
Definition at line 4332 of file timestamp.c.
References date2j(), and j2day().
Referenced by DCH_to_char(), timestamp_part(), timestamp_trunc(), timestamptz_part(), and timestamptz_trunc_internal().
int date2isoyear | ( | int | year, |
int | mon, | ||
int | mday | ||
) |
Definition at line 4387 of file timestamp.c.
References date2j(), and j2day().
Referenced by date2isoyearday(), DCH_to_char(), timestamp_part(), and timestamptz_part().
int date2isoyearday | ( | int | year, |
int | mon, | ||
int | mday | ||
) |
Definition at line 4444 of file timestamp.c.
References date2isoyear(), date2j(), and isoweek2j().
Referenced by DCH_to_char().
Definition at line 2014 of file timestamp.c.
References USECS_PER_SEC.
Referenced by make_timestamptz_at_timezone(), timestamp2timestamptz_opt_overflow(), timestamp_izone(), timestamp_zone(), timestamptz_izone(), timestamptz_zone(), and tm2timestamp().
Definition at line 1793 of file timestamp.c.
References USECS_PER_HOUR, USECS_PER_MINUTE, and USECS_PER_SEC.
Referenced by DecodeDateTime(), DecodeTimeOnly(), and timestamp2tm().
void EncodeSpecialTimestamp | ( | Timestamp | dt, |
char * | str | ||
) |
Definition at line 1531 of file timestamp.c.
References EARLY, elog, ERROR, LATE, TIMESTAMP_IS_NOBEGIN, and TIMESTAMP_IS_NOEND.
Referenced by JsonEncodeDateTime(), PGTYPEStimestamp_to_asc(), timestamp_out(), timestamptz_out(), and timestamptz_to_str().
Datum float8_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 715 of file timestamp.c.
References DATETIME_MIN_JULIAN, ereport, errcode(), errmsg(), ERROR, IS_VALID_TIMESTAMP, PG_GETARG_FLOAT8, PG_RETURN_TIMESTAMP, POSTGRES_EPOCH_JDATE, SECS_PER_DAY, TIMESTAMP_END_JULIAN, TIMESTAMP_NOBEGIN, TIMESTAMP_NOEND, UNIX_EPOCH_JDATE, and USECS_PER_SEC.
Datum generate_series_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5418 of file timestamp.c.
References generate_series_timestamp_fctx::current, DatumGetTimestamp, DirectFunctionCall2, ereport, errcode(), errmsg(), ERROR, generate_series_timestamp_fctx::finish, interval_cmp_internal(), MemoryContextSwitchTo(), MemSet, FuncCallContext::multi_call_memory_ctx, palloc(), PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMP, PointerGetDatum, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, generate_series_timestamp_fctx::step, generate_series_timestamp_fctx::step_sign, timestamp_cmp_internal(), timestamp_pl_interval(), TimestampGetDatum, and FuncCallContext::user_fctx.
Datum generate_series_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5498 of file timestamp.c.
References generate_series_timestamptz_fctx::current, DatumGetTimestampTz, DirectFunctionCall2, ereport, errcode(), errmsg(), ERROR, generate_series_timestamptz_fctx::finish, interval_cmp_internal(), MemoryContextSwitchTo(), MemSet, FuncCallContext::multi_call_memory_ctx, palloc(), PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMPTZ, PointerGetDatum, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, generate_series_timestamptz_fctx::step, generate_series_timestamptz_fctx::step_sign, timestamp_cmp_internal(), timestamptz_pl_interval(), TimestampTzGetDatum, and FuncCallContext::user_fctx.
TimestampTz GetCurrentTimestamp | ( | void | ) |
Definition at line 1578 of file timestamp.c.
References gettimeofday(), POSTGRES_EPOCH_JDATE, SECS_PER_DAY, UNIX_EPOCH_JDATE, and USECS_PER_SEC.
Referenced by ApplyLauncherMain(), ApplyWorkerMain(), asyncQueueFillWarning(), autoprewarm_main(), autovac_refresh_stats(), AutoVacLauncherMain(), backend_read_statsfile(), BackgroundWriterMain(), check_log_duration(), CheckPointGuts(), CleanupBackgroundWorker(), clock_timestamp(), CreateCheckPoint(), CreateEndOfRecoveryRecord(), CreateRestartPoint(), DetermineSleepTime(), disable_timeout(), disable_timeouts(), do_analyze_rel(), do_start_bgworker(), do_start_worker(), drandom(), enable_timeout_after(), enable_timeout_at(), enable_timeouts(), entry_reset(), get_role_password(), GetCurrentTransactionStopTimestamp(), GetReplicationApplyDelay(), GetSnapshotCurrentTimestamp(), handle_sig_alarm(), heap_vacuum_rel(), InitProcessGlobals(), launcher_determine_sleep(), LockBufferForCleanup(), log_disconnections(), LogCheckpointEnd(), logicalrep_worker_launch(), LogicalRepApplyLoop(), maybe_start_bgworkers(), perform_base_backup(), pgfdw_cancel_query(), pgfdw_exec_cleanup_query(), pgfdw_get_cleanup_result(), pgss_shmem_startup(), pgstat_read_statsfiles(), pgstat_recv_inquiry(), pgstat_recv_resetreplslotcounter(), pgstat_recv_resetsharedcounter(), pgstat_recv_resetsinglecounter(), pgstat_recv_resetslrucounter(), pgstat_report_activity(), pgstat_report_analyze(), pgstat_report_autovac(), pgstat_report_checksum_failures_in_db(), pgstat_report_vacuum(), pgstat_send_archiver(), pgstat_send_connstats(), pgstat_write_statsfiles(), PostgresMain(), PostmasterMain(), PrepareTransaction(), process_syncing_tables_for_apply(), ProcessRepliesIfAny(), ProcessStandbyReplyMessage(), ProcessWalSndrMessage(), ProcSleep(), rebuild_database_list(), RecordTransactionAbort(), RecordTransactionAbortPrepared(), RecordTransactionCommitPrepared(), recoveryApplyDelay(), reschedule_timeouts(), reset_dbentry_counters(), ResolveRecoveryConflictWithBufferPin(), ResolveRecoveryConflictWithLock(), ResolveRecoveryConflictWithVirtualXIDs(), send_feedback(), SetCurrentStatementStartTimestamp(), SetCurrentTransactionStopTimestamp(), StartTransaction(), StartupXLOG(), test_pattern(), throttle(), UpdateWorkerStats(), WaitExceedsMaxStandbyDelay(), WaitForWALToBecomeAvailable(), WalReceiverMain(), WalSndKeepalive(), WalSndLoop(), WalSndUpdateProgress(), WalSndWaitForWal(), WalSndWriteData(), XLogBackgroundFlush(), XLogFileRead(), XLogRestorePoint(), XLogSendPhysical(), XLogWalRcvSendHSFeedback(), and XLogWalRcvSendReply().
void GetEpochTime | ( | struct pg_tm * | tm | ) |
Definition at line 2046 of file timestamp.c.
References elog, epoch, ERROR, pg_gmtime(), 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 date_in(), PGTYPESdate_from_asc(), and SetEpochTimestamp().
TimestampTz GetSQLCurrentTimestamp | ( | int32 | typmod | ) |
Definition at line 1596 of file timestamp.c.
References AdjustTimestampForTypmod(), and GetCurrentTransactionStartTimestamp().
Referenced by ExecEvalSQLValueFunction().
Definition at line 1610 of file timestamp.c.
References AdjustTimestampForTypmod(), GetCurrentTransactionStartTimestamp(), and timestamptz2timestamp().
Referenced by ExecEvalSQLValueFunction().
Datum in_range_interval_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3378 of file timestamp.c.
References DatumGetIntervalP, DirectFunctionCall2, ereport, errcode(), errmsg(), ERROR, int128_compare(), int64_to_int128(), interval_cmp_internal(), interval_cmp_value(), interval_mi(), interval_pl(), IntervalPGetDatum, PG_GETARG_BOOL, PG_GETARG_INTERVAL_P, PG_RETURN_BOOL, and val.
Datum in_range_timestamp_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3347 of file timestamp.c.
References DatumGetTimestamp, DirectFunctionCall2, ereport, errcode(), errmsg(), ERROR, int128_compare(), int64_to_int128(), interval_cmp_value(), IntervalPGetDatum, PG_GETARG_BOOL, PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMP, PG_RETURN_BOOL, timestamp_mi_interval(), timestamp_pl_interval(), TimestampGetDatum, and val.
Referenced by in_range_date_interval().
Datum in_range_timestamptz_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3316 of file timestamp.c.
References DatumGetTimestampTz, DirectFunctionCall2, ereport, errcode(), errmsg(), ERROR, int128_compare(), int64_to_int128(), interval_cmp_value(), IntervalPGetDatum, PG_GETARG_BOOL, PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BOOL, timestamptz_mi_interval(), timestamptz_pl_interval(), TimestampTzGetDatum, and val.
Definition at line 1964 of file timestamp.c.
References Interval::day, ereport, errcode(), errmsg(), ERROR, Interval::month, MONTHS_PER_YEAR, SAMESIGN, Interval::time, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_year, USECS_PER_HOUR, USECS_PER_MINUTE, and USECS_PER_SEC.
Referenced by interval_out(), interval_part(), interval_to_char(), and interval_trunc().
Datum interval_accum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3420 of file timestamp.c.
References construct_array(), DatumGetIntervalP, deconstruct_array(), DirectFunctionCall2, elog, ERROR, interval_pl(), IntervalPGetDatum, newval, PG_GETARG_ARRAYTYPE_P, PG_GETARG_INTERVAL_P, PG_RETURN_ARRAYTYPE_P, and Interval::time.
Datum interval_accum_inv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3504 of file timestamp.c.
References construct_array(), DatumGetIntervalP, deconstruct_array(), DirectFunctionCall2, elog, ERROR, interval_mi(), IntervalPGetDatum, newval, PG_GETARG_ARRAYTYPE_P, PG_GETARG_INTERVAL_P, PG_RETURN_ARRAYTYPE_P, and Interval::time.
Datum interval_avg | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3539 of file timestamp.c.
References DatumGetIntervalP, deconstruct_array(), DirectFunctionCall2, elog, ERROR, Float8GetDatum(), interval_div(), IntervalPGetDatum, PG_GETARG_ARRAYTYPE_P, PG_RETURN_NULL, and Interval::time.
Datum interval_cmp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2438 of file timestamp.c.
References interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_INT32.
Referenced by gbt_intvkey_cmp(), and leftmostvalue_interval().
Definition at line 2375 of file timestamp.c.
References int128_compare(), and interval_cmp_value().
Referenced by generate_series_timestamp(), generate_series_timestamptz(), in_range_interval_interval(), interval_cmp(), interval_eq(), interval_ge(), interval_gt(), interval_larger(), interval_le(), interval_lt(), interval_ne(), and interval_smaller().
Definition at line 2350 of file timestamp.c.
References Interval::day, days, int128_add_int64_mul_int64(), int64_to_int128(), Interval::month, Interval::time, and USECS_PER_DAY.
Referenced by in_range_interval_interval(), in_range_timestamp_interval(), in_range_timestamptz_interval(), interval_cmp_internal(), interval_hash(), and interval_hash_extended().
Datum interval_combine | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3455 of file timestamp.c.
References construct_array(), DatumGetIntervalP, deconstruct_array(), DirectFunctionCall2, elog, ERROR, interval_pl(), IntervalPGetDatum, PG_GETARG_ARRAYTYPE_P, PG_RETURN_ARRAYTYPE_P, and Interval::time.
Datum interval_div | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3264 of file timestamp.c.
References Abs, Interval::day, DAYS_PER_MONTH, ereport, errcode(), errmsg(), ERROR, Interval::month, palloc(), PG_GETARG_FLOAT8, PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, SECS_PER_DAY, Interval::time, TSROUND, and USECS_PER_SEC.
Referenced by interval_avg().
Datum interval_eq | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2384 of file timestamp.c.
References interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_BOOL.
Referenced by gbt_intveq().
Datum interval_finite | ( | PG_FUNCTION_ARGS | ) |
Datum interval_ge | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2429 of file timestamp.c.
References interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_BOOL.
Referenced by gbt_intvge().
Datum interval_gt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2411 of file timestamp.c.
References interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_BOOL.
Referenced by gbt_intvgt().
Datum interval_hash | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2454 of file timestamp.c.
References DirectFunctionCall1, hashint8(), int128_to_int64(), Int64GetDatumFast, interval_cmp_value(), and PG_GETARG_INTERVAL_P.
Datum interval_hash_extended | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2472 of file timestamp.c.
References DirectFunctionCall2, hashint8extended(), int128_to_int64(), Int64GetDatumFast, interval_cmp_value(), PG_GETARG_DATUM, and PG_GETARG_INTERVAL_P.
Datum interval_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 880 of file timestamp.c.
References AdjustIntervalForTypmod(), DateTimeParseError(), DecodeInterval(), DecodeISO8601Interval(), DTERR_BAD_FORMAT, DTERR_FIELD_OVERFLOW, DTERR_INTERVAL_OVERFLOW, DTK_DELTA, elog, ereport, errcode(), errmsg(), ERROR, INTERVAL_FULL_RANGE, INTERVAL_RANGE, MAXDATEFIELDS, palloc(), ParseDateTime(), PG_GETARG_CSTRING, PG_GETARG_INT32, PG_GETARG_OID, PG_RETURN_INTERVAL_P, range(), generate_unaccent_rules::str, tm, tm2interval(), 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 check_timezone(), and flatten_set_variable_args().
Datum interval_justify_days | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2799 of file timestamp.c.
References Interval::day, DAYS_PER_MONTH, Interval::month, palloc(), PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, and Interval::time.
Datum interval_justify_hours | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2764 of file timestamp.c.
References Interval::day, Interval::month, palloc(), PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, Interval::time, TMODULO, and USECS_PER_DAY.
Referenced by timestamp_mi().
Datum interval_justify_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2709 of file timestamp.c.
References Interval::day, DAYS_PER_MONTH, Interval::month, palloc(), PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, Interval::time, TMODULO, and USECS_PER_DAY.
Datum interval_larger | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3089 of file timestamp.c.
References interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_INTERVAL_P.
Datum interval_le | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2420 of file timestamp.c.
References interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_BOOL.
Referenced by gbt_intvle().
Datum interval_lt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2402 of file timestamp.c.
References interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_BOOL.
Referenced by abs_interval(), and gbt_intvlt().
Datum interval_mi | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3137 of file timestamp.c.
References Interval::day, ereport, errcode(), errmsg(), ERROR, Interval::month, palloc(), PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, SAMESIGN, and Interval::time.
Referenced by in_range_interval_interval(), interval_accum_inv(), interval_dist(), and interval_lerp().
Datum interval_mul | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3177 of file timestamp.c.
References Abs, Interval::day, DAYS_PER_MONTH, ereport, errcode(), errmsg(), ERROR, FLOAT8_FITS_IN_INT64, Interval::month, palloc(), PG_GETARG_FLOAT8, PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, SECS_PER_DAY, Interval::time, TSROUND, and USECS_PER_SEC.
Referenced by interval_lerp(), and mul_d_interval().
Datum interval_ne | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2393 of file timestamp.c.
References interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_BOOL.
Datum interval_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 956 of file timestamp.c.
References buf, elog, EncodeInterval(), ERROR, interval2tm(), IntervalStyle, MAXDATELEN, PG_GETARG_INTERVAL_P, PG_RETURN_CSTRING, pstrdup(), and tm.
Referenced by flatten_set_variable_args(), timestamp_izone(), timestamptz_izone(), and timetz_izone().
Datum interval_part | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4923 of file timestamp.c.
References Interval::day, DAYS_PER_MONTH, DAYS_PER_YEAR, DecodeSpecial(), DecodeUnits(), downcase_truncate_identifier(), DTK_CENTURY, DTK_DAY, DTK_DECADE, DTK_EPOCH, DTK_HOUR, DTK_MICROSEC, DTK_MILLENNIUM, DTK_MILLISEC, DTK_MINUTE, DTK_MONTH, DTK_QUARTER, DTK_SECOND, DTK_YEAR, elog, ereport, errcode(), errmsg(), ERROR, interval2tm(), Interval::month, MONTHS_PER_YEAR, PG_GETARG_INTERVAL_P, PG_GETARG_TEXT_PP, PG_RETURN_FLOAT8, RESERV, SECS_PER_DAY, Interval::time, 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, generate_unaccent_rules::type, UNITS, UNKNOWN_FIELD, val, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum interval_pl | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3103 of file timestamp.c.
References Interval::day, ereport, errcode(), errmsg(), ERROR, Interval::month, palloc(), PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, SAMESIGN, and Interval::time.
Referenced by in_range_interval_interval(), interval_accum(), interval_combine(), and interval_lerp().
Datum interval_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 978 of file timestamp.c.
References AdjustIntervalForTypmod(), buf, Interval::day, Interval::month, palloc(), PG_GETARG_INT32, PG_GETARG_OID, PG_GETARG_POINTER, PG_RETURN_INTERVAL_P, pq_getmsgint(), pq_getmsgint64(), and Interval::time.
Datum interval_scale | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1309 of file timestamp.c.
References AdjustIntervalForTypmod(), palloc(), PG_GETARG_INT32, PG_GETARG_INTERVAL_P, and PG_RETURN_INTERVAL_P.
Datum interval_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1003 of file timestamp.c.
References buf, Interval::day, Interval::month, PG_GETARG_INTERVAL_P, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendint32(), pq_sendint64(), and Interval::time.
Datum interval_smaller | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3074 of file timestamp.c.
References interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_INTERVAL_P.
Datum interval_support | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1246 of file timestamp.c.
References FuncExpr::args, Assert, DatumGetInt32, exprTypmod(), SupportRequestSimplify::fcall, INTERVAL_FULL_PRECISION, INTERVAL_PRECISION, intervaltypmodleastfield(), IsA, linitial, list_length(), lsecond, MAX_INTERVAL_PRECISION, PG_GETARG_POINTER, PG_RETURN_POINTER, relabel_to_typmod(), and source.
Datum interval_trunc | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4177 of file timestamp.c.
References DecodeUnits(), downcase_truncate_identifier(), DTK_CENTURY, DTK_DAY, DTK_DECADE, DTK_HOUR, DTK_MICROSEC, DTK_MILLENNIUM, DTK_MILLISEC, DTK_MINUTE, DTK_MONTH, DTK_QUARTER, DTK_SECOND, DTK_WEEK, DTK_YEAR, elog, ereport, errcode(), errmsg(), ERROR, interval2tm(), palloc(), PG_GETARG_INTERVAL_P, PG_GETARG_TEXT_PP, PG_RETURN_INTERVAL_P, tm, tm2interval(), pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_year, generate_unaccent_rules::type, UNITS, val, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum interval_um | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3045 of file timestamp.c.
References Interval::day, ereport, errcode(), errmsg(), ERROR, Interval::month, palloc(), PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, SAMESIGN, and Interval::time.
Referenced by abs_interval().
Datum intervaltypmodin | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1028 of file timestamp.c.
References ArrayGetIntegerTypmods(), DAY, ereport, errcode(), errmsg(), ERROR, HOUR, INTERVAL_FULL_PRECISION, INTERVAL_FULL_RANGE, INTERVAL_MASK, INTERVAL_TYPMOD, MAX_INTERVAL_PRECISION, MINUTE, MONTH, PG_GETARG_ARRAYTYPE_P, PG_RETURN_INT32, SECOND, WARNING, and YEAR.
|
static |
Definition at line 1193 of file timestamp.c.
References DAY, elog, ERROR, HOUR, INTERVAL_FULL_RANGE, INTERVAL_MASK, INTERVAL_RANGE, MINUTE, MONTH, SECOND, and YEAR.
Referenced by interval_support().
Datum intervaltypmodout | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1107 of file timestamp.c.
References DAY, elog, ERROR, HOUR, INTERVAL_FULL_PRECISION, INTERVAL_FULL_RANGE, INTERVAL_MASK, INTERVAL_PRECISION, INTERVAL_RANGE, MINUTE, MONTH, palloc(), PG_GETARG_INT32, PG_RETURN_CSTRING, SECOND, snprintf, and YEAR.
void isoweek2date | ( | int | woy, |
int * | year, | ||
int * | mon, | ||
int * | mday | ||
) |
Definition at line 4301 of file timestamp.c.
References isoweek2j(), and j2date().
Referenced by do_to_timestamp(), timestamp_trunc(), and timestamptz_trunc_internal().
int isoweek2j | ( | int | year, |
int | week | ||
) |
Definition at line 4281 of file timestamp.c.
References date2j(), and j2day().
Referenced by date2isoyearday(), do_to_timestamp(), isoweek2date(), and isoweekdate2date().
void isoweekdate2date | ( | int | isoweek, |
int | wday, | ||
int * | year, | ||
int * | mon, | ||
int * | mday | ||
) |
Definition at line 4314 of file timestamp.c.
References isoweek2j(), and j2date().
Referenced by do_to_timestamp().
Datum make_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1495 of file timestamp.c.
References Interval::day, days, ereport, errcode(), errmsg(), ERROR, Interval::month, months, MONTHS_PER_YEAR, palloc(), PG_GETARG_FLOAT8, PG_GETARG_INT32, PG_RETURN_INTERVAL_P, SECS_PER_HOUR, SECS_PER_MINUTE, Interval::time, and USECS_PER_SEC.
Datum make_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 634 of file timestamp.c.
References make_timestamp_internal(), PG_GETARG_FLOAT8, PG_GETARG_INT32, and PG_RETURN_TIMESTAMP.
|
static |
Definition at line 552 of file timestamp.c.
References date2j(), DTK_DATE_M, ereport, errcode(), errmsg(), ERROR, float_time_overflows(), IS_VALID_JULIAN, IS_VALID_TIMESTAMP, MINS_PER_HOUR, POSTGRES_EPOCH_JDATE, SECS_PER_MINUTE, pg_tm::tm_mday, pg_tm::tm_mon, pg_tm::tm_year, USECS_PER_DAY, USECS_PER_SEC, and ValidateDate().
Referenced by make_timestamp(), make_timestamptz(), and make_timestamptz_at_timezone().
Datum make_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 654 of file timestamp.c.
References make_timestamp_internal(), PG_GETARG_FLOAT8, PG_GETARG_INT32, PG_RETURN_TIMESTAMPTZ, and timestamp2timestamptz().
Datum make_timestamptz_at_timezone | ( | PG_FUNCTION_ARGS | ) |
Definition at line 675 of file timestamp.c.
References dt2local(), ereport, errcode(), errmsg(), ERROR, IS_VALID_TIMESTAMP, make_timestamp_internal(), parse_sane_timezone(), PG_GETARG_FLOAT8, PG_GETARG_INT32, PG_GETARG_TEXT_PP, PG_RETURN_TIMESTAMPTZ, and timestamp2tm().
Datum mul_d_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3254 of file timestamp.c.
References DirectFunctionCall2, interval_mul(), and PG_GETARG_DATUM.
|
static |
Definition at line 4461 of file timestamp.c.
References DTK_CENTURY, DTK_DAY, DTK_DECADE, DTK_DOW, DTK_DOY, DTK_EPOCH, DTK_HOUR, DTK_ISODOW, DTK_ISOYEAR, DTK_JULIAN, DTK_MICROSEC, DTK_MILLENNIUM, DTK_MILLISEC, DTK_MINUTE, DTK_MONTH, DTK_QUARTER, DTK_SECOND, DTK_TZ, DTK_TZ_HOUR, DTK_TZ_MINUTE, DTK_WEEK, DTK_YEAR, ereport, errcode(), errmsg(), ERROR, get_float8_infinity(), RESERV, and UNITS.
Referenced by timestamp_part(), and timestamptz_part().
Datum now | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1542 of file timestamp.c.
References GetCurrentTransactionStartTimestamp(), and PG_RETURN_TIMESTAMPTZ.
Referenced by advanceConnectionState(), ApplyLauncherMain(), BackgroundWriterMain(), CheckArchiveTimeout(), CheckpointerMain(), drandom(), dumpTimestamp(), enable_timeout(), enable_timeout_after(), enable_timeout_at(), enable_timeouts(), GetSnapshotCurrentTimestamp(), handle_sig_alarm(), HandleCopyStream(), LockBufferForCleanup(), logicalrep_worker_launch(), LogicalRepApplyLoop(), maybe_start_bgworkers(), mxid_age(), OutputFsync(), pg_timezone_abbrevs(), pgfdw_get_cleanup_result(), pgstat_report_stat(), pqSocketPoll(), printProgressReport(), process_syncing_tables_for_apply(), ProcessKeepaliveMsg(), ProcessStandbyReplyMessage(), ProcSleep(), progress_report(), RequestXLogStreaming(), ResolveRecoveryConflictWithVirtualXIDs(), send_feedback(), ServerLoop(), set_next_rotation_time(), set_random_seed(), StreamLogicalLog(), SysLoggerMain(), threadRun(), timetz_zone(), WaitForWALToBecomeAvailable(), WalRcvRunning(), WalRcvStreaming(), WalReceiverMain(), WalSndUpdateProgress(), WalSndWriteData(), xid_age(), XLogBackgroundFlush(), XLogWalRcvSendHSFeedback(), and XLogWalRcvSendReply().
Datum overlaps_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2492 of file timestamp.c.
References PG_ARGISNULL, PG_GETARG_DATUM, PG_RETURN_BOOL, PG_RETURN_NULL, TIMESTAMP_GT, and TIMESTAMP_LT.
Definition at line 468 of file timestamp.c.
References DecodeTimezone(), DecodeTimezoneAbbrev(), DetermineTimeZoneAbbrevOffset(), DetermineTimeZoneOffset(), downcase_truncate_identifier(), DTERR_BAD_FORMAT, DTERR_TZDISP_OVERFLOW, DTZ, DYNTZ, ereport, errcode(), errhint(), errmsg(), ERROR, pg_tzset(), text_to_cstring_buffer(), generate_unaccent_rules::type, TZ, TZ_STRLEN_MAX, and val.
Referenced by make_timestamptz_at_timezone().
Datum pg_conf_load_time | ( | PG_FUNCTION_ARGS | ) |
Datum pg_postmaster_start_time | ( | PG_FUNCTION_ARGS | ) |
Timestamp SetEpochTimestamp | ( | void | ) |
Definition at line 2068 of file timestamp.c.
References GetEpochTime(), tm, and tm2timestamp().
Referenced by dttofmtasc_replace(), PGTYPEStimestamp_from_asc(), timestamp_in(), timestamp_part(), timestamptz_in(), and timestamptz_part().
Datum statement_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1548 of file timestamp.c.
References GetCurrentStatementStartTimestamp(), and PG_RETURN_TIMESTAMPTZ.
|
static |
Definition at line 2008 of file timestamp.c.
References MINS_PER_HOUR, SECS_PER_MINUTE, and USECS_PER_SEC.
Referenced by tm2timestamp().
TimestampTz time_t_to_timestamptz | ( | pg_time_t | tm | ) |
Definition at line 1730 of file timestamp.c.
References POSTGRES_EPOCH_JDATE, SECS_PER_DAY, UNIX_EPOCH_JDATE, and USECS_PER_SEC.
Referenced by pg_control_checkpoint(), pg_control_system(), pg_ls_dir_files(), and pg_stat_file().
Datum timeofday | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1624 of file timestamp.c.
References buf, cstring_to_text(), gettimeofday(), pg_localtime(), PG_RETURN_TEXT_P, pg_strftime(), session_timezone, and snprintf.