PostgreSQL Source Code  git master
timestamp.h File Reference
#include "datatype/timestamp.h"
#include "fmgr.h"
#include "pgtime.h"
Include dependency graph for timestamp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PG_GETARG_TIMESTAMP(n)   DatumGetTimestamp(PG_GETARG_DATUM(n))
 
#define PG_GETARG_TIMESTAMPTZ(n)   DatumGetTimestampTz(PG_GETARG_DATUM(n))
 
#define PG_GETARG_INTERVAL_P(n)   DatumGetIntervalP(PG_GETARG_DATUM(n))
 
#define PG_RETURN_TIMESTAMP(x)   return TimestampGetDatum(x)
 
#define PG_RETURN_TIMESTAMPTZ(x)   return TimestampTzGetDatum(x)
 
#define PG_RETURN_INTERVAL_P(x)   return IntervalPGetDatum(x)
 
#define TIMESTAMP_MASK(b)   (1 << (b))
 
#define INTERVAL_MASK(b)   (1 << (b))
 
#define INTERVAL_FULL_RANGE   (0x7FFF)
 
#define INTERVAL_RANGE_MASK   (0x7FFF)
 
#define INTERVAL_FULL_PRECISION   (0xFFFF)
 
#define INTERVAL_PRECISION_MASK   (0xFFFF)
 
#define INTERVAL_TYPMOD(p, r)   ((((r) & INTERVAL_RANGE_MASK) << 16) | ((p) & INTERVAL_PRECISION_MASK))
 
#define INTERVAL_PRECISION(t)   ((t) & INTERVAL_PRECISION_MASK)
 
#define INTERVAL_RANGE(t)   (((t) >> 16) & INTERVAL_RANGE_MASK)
 
#define TimestampTzPlusMilliseconds(tz, ms)   ((tz) + ((ms) * (int64) 1000))
 
#define TimestampTzPlusSeconds(tz, s)   ((tz) + ((s) * (int64) 1000000))
 
#define timestamptz_cmp_internal(dt1, dt2)   timestamp_cmp_internal(dt1, dt2)
 

Functions

static Timestamp DatumGetTimestamp (Datum X)
 
static TimestampTz DatumGetTimestampTz (Datum X)
 
static IntervalDatumGetIntervalP (Datum X)
 
static Datum TimestampGetDatum (Timestamp X)
 
static Datum TimestampTzGetDatum (TimestampTz X)
 
static Datum IntervalPGetDatum (const Interval *X)
 
int32 anytimestamp_typmod_check (bool istz, int32 typmod)
 
TimestampTz GetCurrentTimestamp (void)
 
TimestampTz GetSQLCurrentTimestamp (int32 typmod)
 
Timestamp GetSQLLocalTimestamp (int32 typmod)
 
void TimestampDifference (TimestampTz start_time, TimestampTz stop_time, long *secs, int *microsecs)
 
long TimestampDifferenceMilliseconds (TimestampTz start_time, TimestampTz stop_time)
 
bool TimestampDifferenceExceeds (TimestampTz start_time, TimestampTz stop_time, int msec)
 
TimestampTz time_t_to_timestamptz (pg_time_t tm)
 
pg_time_t timestamptz_to_time_t (TimestampTz t)
 
const char * timestamptz_to_str (TimestampTz t)
 
int tm2timestamp (struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result)
 
int timestamp2tm (Timestamp dt, int *tzp, struct pg_tm *tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone)
 
void dt2time (Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec)
 
void interval2itm (Interval span, struct pg_itm *itm)
 
int itm2interval (struct pg_itm *itm, Interval *span)
 
int itmin2interval (struct pg_itm_in *itm_in, Interval *span)
 
Timestamp SetEpochTimestamp (void)
 
void GetEpochTime (struct pg_tm *tm)
 
int timestamp_cmp_internal (Timestamp dt1, Timestamp dt2)
 
TimestampTz timestamp2timestamptz_opt_overflow (Timestamp timestamp, int *overflow)
 
int32 timestamp_cmp_timestamptz_internal (Timestamp timestampVal, TimestampTz dt2)
 
int isoweek2j (int year, int week)
 
void isoweek2date (int woy, int *year, int *mon, int *mday)
 
void isoweekdate2date (int isoweek, int wday, int *year, int *mon, int *mday)
 
int date2isoweek (int year, int mon, int mday)
 
int date2isoyear (int year, int mon, int mday)
 
int date2isoyearday (int year, int mon, int mday)
 
bool TimestampTimestampTzRequiresRewrite (void)
 

Variables

PGDLLIMPORT TimestampTz PgStartTime
 
PGDLLIMPORT TimestampTz PgReloadTime
 

Macro Definition Documentation

◆ INTERVAL_FULL_PRECISION

#define INTERVAL_FULL_PRECISION   (0xFFFF)

Definition at line 78 of file timestamp.h.

◆ INTERVAL_FULL_RANGE

#define INTERVAL_FULL_RANGE   (0x7FFF)

Definition at line 76 of file timestamp.h.

◆ INTERVAL_MASK

#define INTERVAL_MASK (   b)    (1 << (b))

Definition at line 73 of file timestamp.h.

◆ INTERVAL_PRECISION

#define INTERVAL_PRECISION (   t)    ((t) & INTERVAL_PRECISION_MASK)

Definition at line 81 of file timestamp.h.

◆ INTERVAL_PRECISION_MASK

#define INTERVAL_PRECISION_MASK   (0xFFFF)

Definition at line 79 of file timestamp.h.

◆ INTERVAL_RANGE

#define INTERVAL_RANGE (   t)    (((t) >> 16) & INTERVAL_RANGE_MASK)

Definition at line 82 of file timestamp.h.

◆ INTERVAL_RANGE_MASK

#define INTERVAL_RANGE_MASK   (0x7FFF)

Definition at line 77 of file timestamp.h.

◆ INTERVAL_TYPMOD

#define INTERVAL_TYPMOD (   p,
 
)    ((((r) & INTERVAL_RANGE_MASK) << 16) | ((p) & INTERVAL_PRECISION_MASK))

Definition at line 80 of file timestamp.h.

◆ PG_GETARG_INTERVAL_P

#define PG_GETARG_INTERVAL_P (   n)    DatumGetIntervalP(PG_GETARG_DATUM(n))

Definition at line 65 of file timestamp.h.

◆ PG_GETARG_TIMESTAMP

#define PG_GETARG_TIMESTAMP (   n)    DatumGetTimestamp(PG_GETARG_DATUM(n))

Definition at line 63 of file timestamp.h.

◆ PG_GETARG_TIMESTAMPTZ

#define PG_GETARG_TIMESTAMPTZ (   n)    DatumGetTimestampTz(PG_GETARG_DATUM(n))

Definition at line 64 of file timestamp.h.

◆ PG_RETURN_INTERVAL_P

#define PG_RETURN_INTERVAL_P (   x)    return IntervalPGetDatum(x)

Definition at line 69 of file timestamp.h.

◆ PG_RETURN_TIMESTAMP

#define PG_RETURN_TIMESTAMP (   x)    return TimestampGetDatum(x)

Definition at line 67 of file timestamp.h.

◆ PG_RETURN_TIMESTAMPTZ

#define PG_RETURN_TIMESTAMPTZ (   x)    return TimestampTzGetDatum(x)

Definition at line 68 of file timestamp.h.

◆ TIMESTAMP_MASK

#define TIMESTAMP_MASK (   b)    (1 << (b))

Definition at line 72 of file timestamp.h.

◆ timestamptz_cmp_internal

#define timestamptz_cmp_internal (   dt1,
  dt2 
)    timestamp_cmp_internal(dt1, dt2)

Definition at line 131 of file timestamp.h.

◆ TimestampTzPlusMilliseconds

#define TimestampTzPlusMilliseconds (   tz,
  ms 
)    ((tz) + ((ms) * (int64) 1000))

Definition at line 85 of file timestamp.h.

◆ TimestampTzPlusSeconds

#define TimestampTzPlusSeconds (   tz,
 
)    ((tz) + ((s) * (int64) 1000000))

Definition at line 86 of file timestamp.h.

Function Documentation

◆ anytimestamp_typmod_check()

int32 anytimestamp_typmod_check ( bool  istz,
int32  typmod 
)

Definition at line 124 of file timestamp.c.

125 {
126  if (typmod < 0)
127  ereport(ERROR,
128  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
129  errmsg("TIMESTAMP(%d)%s precision must not be negative",
130  typmod, (istz ? " WITH TIME ZONE" : ""))));
131  if (typmod > MAX_TIMESTAMP_PRECISION)
132  {
134  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
135  errmsg("TIMESTAMP(%d)%s precision reduced to maximum allowed, %d",
136  typmod, (istz ? " WITH TIME ZONE" : ""),
138  typmod = MAX_TIMESTAMP_PRECISION;
139  }
140 
141  return typmod;
142 }
#define MAX_TIMESTAMP_PRECISION
Definition: timestamp.h:92
int errcode(int sqlerrcode)
Definition: elog.c:853
int errmsg(const char *fmt,...)
Definition: elog.c:1070
#define WARNING
Definition: elog.h:36
#define ERROR
Definition: elog.h:39
#define ereport(elevel,...)
Definition: elog.h:149

References ereport, errcode(), errmsg(), ERROR, MAX_TIMESTAMP_PRECISION, and WARNING.

Referenced by anytimestamp_typmodin(), executeDateTimeMethod(), and transformSQLValueFunction().

◆ date2isoweek()

int date2isoweek ( int  year,
int  mon,
int  mday 
)

Definition at line 5168 of file timestamp.c.

5169 {
5170  float8 result;
5171  int day0,
5172  day4,
5173  dayn;
5174 
5175  /* current day */
5176  dayn = date2j(year, mon, mday);
5177 
5178  /* fourth day of current year */
5179  day4 = date2j(year, 1, 4);
5180 
5181  /* day0 == offset to first day of week (Monday) */
5182  day0 = j2day(day4 - 1);
5183 
5184  /*
5185  * We need the first week containing a Thursday, otherwise this day falls
5186  * into the previous year for purposes of counting weeks
5187  */
5188  if (dayn < day4 - day0)
5189  {
5190  day4 = date2j(year - 1, 1, 4);
5191 
5192  /* day0 == offset to first day of week (Monday) */
5193  day0 = j2day(day4 - 1);
5194  }
5195 
5196  result = (dayn - (day4 - day0)) / 7 + 1;
5197 
5198  /*
5199  * Sometimes the last few days in a year will fall into the first week of
5200  * the next year, so check for this.
5201  */
5202  if (result >= 52)
5203  {
5204  day4 = date2j(year + 1, 1, 4);
5205 
5206  /* day0 == offset to first day of week (Monday) */
5207  day0 = j2day(day4 - 1);
5208 
5209  if (dayn >= day4 - day0)
5210  result = (dayn - (day4 - day0)) / 7 + 1;
5211  }
5212 
5213  return (int) result;
5214 }
int j2day(int date)
Definition: datetime.c:344
int date2j(int year, int month, int day)
Definition: datetime.c:286
double float8
Definition: c.h:630

References date2j(), and j2day().

Referenced by DCH_to_char(), extract_date(), timestamp_part_common(), timestamp_trunc(), timestamptz_part_common(), and timestamptz_trunc_internal().

◆ date2isoyear()

int date2isoyear ( int  year,
int  mon,
int  mday 
)

Definition at line 5223 of file timestamp.c.

5224 {
5225  float8 result;
5226  int day0,
5227  day4,
5228  dayn;
5229 
5230  /* current day */
5231  dayn = date2j(year, mon, mday);
5232 
5233  /* fourth day of current year */
5234  day4 = date2j(year, 1, 4);
5235 
5236  /* day0 == offset to first day of week (Monday) */
5237  day0 = j2day(day4 - 1);
5238 
5239  /*
5240  * We need the first week containing a Thursday, otherwise this day falls
5241  * into the previous year for purposes of counting weeks
5242  */
5243  if (dayn < day4 - day0)
5244  {
5245  day4 = date2j(year - 1, 1, 4);
5246 
5247  /* day0 == offset to first day of week (Monday) */
5248  day0 = j2day(day4 - 1);
5249 
5250  year--;
5251  }
5252 
5253  result = (dayn - (day4 - day0)) / 7 + 1;
5254 
5255  /*
5256  * Sometimes the last few days in a year will fall into the first week of
5257  * the next year, so check for this.
5258  */
5259  if (result >= 52)
5260  {
5261  day4 = date2j(year + 1, 1, 4);
5262 
5263  /* day0 == offset to first day of week (Monday) */
5264  day0 = j2day(day4 - 1);
5265 
5266  if (dayn >= day4 - day0)
5267  year++;
5268  }
5269 
5270  return year;
5271 }

References date2j(), and j2day().

Referenced by date2isoyearday(), DCH_to_char(), extract_date(), timestamp_part_common(), and timestamptz_part_common().

◆ date2isoyearday()

int date2isoyearday ( int  year,
int  mon,
int  mday 
)

Definition at line 5280 of file timestamp.c.

5281 {
5282  return date2j(year, mon, mday) - isoweek2j(date2isoyear(year, mon, mday), 1) + 1;
5283 }
int isoweek2j(int year, int week)
Definition: timestamp.c:5117
int date2isoyear(int year, int mon, int mday)
Definition: timestamp.c:5223

References date2isoyear(), date2j(), and isoweek2j().

Referenced by DCH_to_char().

◆ DatumGetIntervalP()

◆ DatumGetTimestamp()

◆ DatumGetTimestampTz()

static TimestampTz DatumGetTimestampTz ( Datum  X)
inlinestatic

◆ dt2time()

void dt2time ( Timestamp  jd,
int *  hour,
int *  min,
int *  sec,
fsec_t fsec 
)

Definition at line 1875 of file timestamp.c.

1876 {
1877  TimeOffset time;
1878 
1879  time = jd;
1880 
1881  *hour = time / USECS_PER_HOUR;
1882  time -= (*hour) * USECS_PER_HOUR;
1883  *min = time / USECS_PER_MINUTE;
1884  time -= (*min) * USECS_PER_MINUTE;
1885  *sec = time / USECS_PER_SEC;
1886  *fsec = time - (*sec * USECS_PER_SEC);
1887 } /* dt2time() */
#define USECS_PER_HOUR
Definition: timestamp.h:132
#define USECS_PER_SEC
Definition: timestamp.h:134
#define USECS_PER_MINUTE
Definition: timestamp.h:133
int64 TimeOffset
Definition: timestamp.h:40

References USECS_PER_HOUR, USECS_PER_MINUTE, and USECS_PER_SEC.

Referenced by DecodeDateTime(), DecodeTimeOnly(), and timestamp2tm().

◆ GetCurrentTimestamp()

TimestampTz GetCurrentTimestamp ( void  )

Definition at line 1655 of file timestamp.c.

1656 {
1657  TimestampTz result;
1658  struct timeval tp;
1659 
1660  gettimeofday(&tp, NULL);
1661 
1662  result = (TimestampTz) tp.tv_sec -
1664  result = (result * USECS_PER_SEC) + tp.tv_usec;
1665 
1666  return result;
1667 }
#define UNIX_EPOCH_JDATE
Definition: timestamp.h:234
#define SECS_PER_DAY
Definition: timestamp.h:126
#define POSTGRES_EPOCH_JDATE
Definition: timestamp.h:235
int gettimeofday(struct timeval *tp, void *tzp)

References gettimeofday(), POSTGRES_EPOCH_JDATE, SECS_PER_DAY, UNIX_EPOCH_JDATE, and USECS_PER_SEC.

Referenced by ApplyLauncherMain(), asyncQueueFillWarning(), autoprewarm_main(), BackgroundWriterMain(), bbsink_copystream_archive_contents(), bbsink_copystream_end_archive(), bbsink_copystream_new(), bbsink_throttle_begin_backup(), check_log_duration(), CheckPointGuts(), CleanupBackgroundWorker(), clock_timestamp(), CreateCheckPoint(), CreateEndOfRecoveryRecord(), CreateOverwriteContrecordRecord(), CreateRestartPoint(), dblink_cancel_query(), DetermineSleepTime(), disable_timeout(), disable_timeouts(), do_analyze_rel(), do_start_bgworker(), do_start_worker(), enable_startup_progress_timeout(), enable_timeout_after(), enable_timeout_at(), enable_timeout_every(), enable_timeouts(), entry_alloc(), entry_reset(), get_role_password(), GetCurrentTransactionStopTimestamp(), GetReplicationApplyDelay(), handle_sig_alarm(), has_startup_progress_timeout_expired(), heap_vacuum_rel(), initialize_prng(), InitProcessGlobals(), KnownAssignedXidsCompress(), launcher_determine_sleep(), libpqsrv_cancel(), LockBufferForCleanup(), log_disconnections(), LogCheckpointEnd(), logicalrep_worker_launch(), LogicalRepApplyLoop(), maybe_start_bgworkers(), pa_send_data(), PerformWalRecovery(), pgfdw_abort_cleanup_begin(), pgfdw_cancel_query(), pgfdw_exec_cleanup_query(), pgfdw_finish_abort_cleanup(), pgfdw_get_cleanup_result(), pgss_shmem_startup(), pgstat_build_snapshot(), pgstat_report_activity(), pgstat_report_analyze(), pgstat_report_archiver(), pgstat_report_autovac(), pgstat_report_checksum_failures_in_db(), pgstat_report_stat(), pgstat_report_vacuum(), pgstat_reset(), pgstat_reset_after_failure(), pgstat_reset_counters(), pgstat_reset_of_kind(), pgstat_reset_slru(), PostgresSingleUserMain(), PostmasterMain(), PrepareForIncrementalBackup(), PrepareTransaction(), process_syncing_tables_for_apply(), ProcessConfigFileInternal(), ProcessPendingWrites(), ProcessRepliesIfAny(), ProcessStandbyReplyMessage(), ProcessWalSndrMessage(), ProcSleep(), rebuild_database_list(), RecordTransactionAbort(), RecordTransactionAbortPrepared(), RecordTransactionCommitPrepared(), recoveryApplyDelay(), ReplicationSlotRelease(), reschedule_timeouts(), ResolveRecoveryConflictWithBufferPin(), ResolveRecoveryConflictWithLock(), ResolveRecoveryConflictWithVirtualXIDs(), RestoreSlotFromDisk(), send_feedback(), SetCurrentStatementStartTimestamp(), SetupApplyOrSyncWorker(), StartTransaction(), test_pattern(), test_random(), throttle(), update_synced_slots_inactive_since(), UpdateWorkerStats(), WaitExceedsMaxStandbyDelay(), WaitForWalSummarization(), WaitForWALToBecomeAvailable(), WalReceiverMain(), WalSndKeepalive(), WalSndLoop(), WalSndUpdateProgress(), WalSndWaitForWal(), WalSndWriteData(), XLogBackgroundFlush(), XLogFileRead(), XLogPrefetchResetStats(), XLogPrefetchShmemInit(), XLogRestorePoint(), XLogSendPhysical(), XLogWalRcvSendHSFeedback(), and XLogWalRcvSendReply().

◆ GetEpochTime()

void GetEpochTime ( struct pg_tm tm)

Definition at line 2169 of file timestamp.c.

2170 {
2171  struct pg_tm *t0;
2172  pg_time_t epoch = 0;
2173 
2174  t0 = pg_gmtime(&epoch);
2175 
2176  if (t0 == NULL)
2177  elog(ERROR, "could not convert epoch to timestamp: %m");
2178 
2179  tm->tm_year = t0->tm_year;
2180  tm->tm_mon = t0->tm_mon;
2181  tm->tm_mday = t0->tm_mday;
2182  tm->tm_hour = t0->tm_hour;
2183  tm->tm_min = t0->tm_min;
2184  tm->tm_sec = t0->tm_sec;
2185 
2186  tm->tm_year += 1900;
2187  tm->tm_mon++;
2188 }
#define elog(elevel,...)
Definition: elog.h:224
static struct pg_tm tm
Definition: localtime.c:104
struct pg_tm * pg_gmtime(const pg_time_t *timep)
Definition: localtime.c:1389
int64 pg_time_t
Definition: pgtime.h:23
Definition: pgtime.h:35
int tm_hour
Definition: pgtime.h:38
int tm_mday
Definition: pgtime.h:39
int tm_mon
Definition: pgtime.h:40
int tm_min
Definition: pgtime.h:37
int tm_sec
Definition: pgtime.h:36
int tm_year
Definition: pgtime.h:41
static const unsigned __int64 epoch

References elog, epoch, ERROR, pg_gmtime(), 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 date_in(), PGTYPESdate_from_asc(), and SetEpochTimestamp().

◆ GetSQLCurrentTimestamp()

TimestampTz GetSQLCurrentTimestamp ( int32  typmod)

Definition at line 1673 of file timestamp.c.

1674 {
1675  TimestampTz ts;
1676 
1678  if (typmod >= 0)
1679  AdjustTimestampForTypmod(&ts, typmod, NULL);
1680  return ts;
1681 }
bool AdjustTimestampForTypmod(Timestamp *time, int32 typmod, Node *escontext)
Definition: timestamp.c:367
TimestampTz GetCurrentTransactionStartTimestamp(void)
Definition: xact.c:868

References AdjustTimestampForTypmod(), and GetCurrentTransactionStartTimestamp().

Referenced by ExecEvalSQLValueFunction().

◆ GetSQLLocalTimestamp()

Timestamp GetSQLLocalTimestamp ( int32  typmod)

Definition at line 1687 of file timestamp.c.

1688 {
1689  Timestamp ts;
1690 
1692  if (typmod >= 0)
1693  AdjustTimestampForTypmod(&ts, typmod, NULL);
1694  return ts;
1695 }
static Timestamp timestamptz2timestamp(TimestampTz timestamp)
Definition: timestamp.c:6374

References AdjustTimestampForTypmod(), GetCurrentTransactionStartTimestamp(), and timestamptz2timestamp().

Referenced by ExecEvalSQLValueFunction().

◆ interval2itm()

void interval2itm ( Interval  span,
struct pg_itm itm 
)

Definition at line 2048 of file timestamp.c.

2049 {
2050  TimeOffset time;
2051  TimeOffset tfrac;
2052 
2053  itm->tm_year = span.month / MONTHS_PER_YEAR;
2054  itm->tm_mon = span.month % MONTHS_PER_YEAR;
2055  itm->tm_mday = span.day;
2056  time = span.time;
2057 
2058  tfrac = time / USECS_PER_HOUR;
2059  time -= tfrac * USECS_PER_HOUR;
2060  itm->tm_hour = tfrac;
2061  tfrac = time / USECS_PER_MINUTE;
2062  time -= tfrac * USECS_PER_MINUTE;
2063  itm->tm_min = (int) tfrac;
2064  tfrac = time / USECS_PER_SEC;
2065  time -= tfrac * USECS_PER_SEC;
2066  itm->tm_sec = (int) tfrac;
2067  itm->tm_usec = (int) time;
2068 }
#define MONTHS_PER_YEAR
Definition: timestamp.h:108
int32 day
Definition: timestamp.h:51
int32 month
Definition: timestamp.h:52
TimeOffset time
Definition: timestamp.h:49
int64 tm_hour
Definition: timestamp.h:70
int tm_year
Definition: timestamp.h:73
int tm_mon
Definition: timestamp.h:72
int tm_mday
Definition: timestamp.h:71
int tm_sec
Definition: timestamp.h:68
int tm_min
Definition: timestamp.h:69
int tm_usec
Definition: timestamp.h:67

References Interval::day, Interval::month, MONTHS_PER_YEAR, Interval::time, pg_itm::tm_hour, pg_itm::tm_mday, pg_itm::tm_min, pg_itm::tm_mon, pg_itm::tm_sec, pg_itm::tm_usec, pg_itm::tm_year, USECS_PER_HOUR, USECS_PER_MINUTE, and USECS_PER_SEC.

Referenced by interval_out(), interval_part_common(), interval_to_char(), and interval_trunc().

◆ IntervalPGetDatum()

◆ isoweek2date()

void isoweek2date ( int  woy,
int *  year,
int *  mon,
int *  mday 
)

Definition at line 5137 of file timestamp.c.

5138 {
5139  j2date(isoweek2j(*year, woy), year, mon, mday);
5140 }
void j2date(int jd, int *year, int *month, int *day)
Definition: datetime.c:311

References isoweek2j(), and j2date().

Referenced by do_to_timestamp(), timestamp_trunc(), and timestamptz_trunc_internal().

◆ isoweek2j()

int isoweek2j ( int  year,
int  week 
)

Definition at line 5117 of file timestamp.c.

5118 {
5119  int day0,
5120  day4;
5121 
5122  /* fourth day of current year */
5123  day4 = date2j(year, 1, 4);
5124 
5125  /* day0 == offset to first day of week (Monday) */
5126  day0 = j2day(day4 - 1);
5127 
5128  return ((week - 1) * 7) + (day4 - day0);
5129 }

References date2j(), and j2day().

Referenced by date2isoyearday(), do_to_timestamp(), isoweek2date(), and isoweekdate2date().

◆ isoweekdate2date()

void isoweekdate2date ( int  isoweek,
int  wday,
int *  year,
int *  mon,
int *  mday 
)

Definition at line 5150 of file timestamp.c.

5151 {
5152  int jday;
5153 
5154  jday = isoweek2j(*year, isoweek);
5155  /* convert Gregorian week start (Sunday=1) to ISO week start (Monday=1) */
5156  if (wday > 1)
5157  jday += wday - 2;
5158  else
5159  jday += 6;
5160  j2date(jday, year, mon, mday);
5161 }

References isoweek2j(), and j2date().

Referenced by do_to_timestamp().

◆ itm2interval()

int itm2interval ( struct pg_itm itm,
Interval span 
)

Definition at line 2078 of file timestamp.c.

2079 {
2080  int64 total_months = (int64) itm->tm_year * MONTHS_PER_YEAR + itm->tm_mon;
2081 
2082  if (total_months > INT_MAX || total_months < INT_MIN)
2083  return -1;
2084  span->month = (int32) total_months;
2085  span->day = itm->tm_mday;
2087  &span->time))
2088  return -1;
2089  /* tm_min, tm_sec are 32 bits, so intermediate products can't overflow */
2090  if (pg_add_s64_overflow(span->time, itm->tm_min * USECS_PER_MINUTE,
2091  &span->time))
2092  return -1;
2093  if (pg_add_s64_overflow(span->time, itm->tm_sec * USECS_PER_SEC,
2094  &span->time))
2095  return -1;
2096  if (pg_add_s64_overflow(span->time, itm->tm_usec,
2097  &span->time))
2098  return -1;
2099  if (INTERVAL_NOT_FINITE(span))
2100  return -1;
2101  return 0;
2102 }
signed int int32
Definition: c.h:494
#define INTERVAL_NOT_FINITE(i)
Definition: timestamp.h:195
static bool pg_mul_s64_overflow(int64 a, int64 b, int64 *result)
Definition: int.h:219
static bool pg_add_s64_overflow(int64 a, int64 b, int64 *result)
Definition: int.h:161
if(TABLE==NULL||TABLE_index==NULL)
Definition: isn.c:77

References Interval::day, if(), INTERVAL_NOT_FINITE, Interval::month, MONTHS_PER_YEAR, pg_add_s64_overflow(), pg_mul_s64_overflow(), Interval::time, pg_itm::tm_hour, pg_itm::tm_mday, pg_itm::tm_min, pg_itm::tm_mon, pg_itm::tm_sec, pg_itm::tm_usec, pg_itm::tm_year, USECS_PER_HOUR, USECS_PER_MINUTE, and USECS_PER_SEC.

Referenced by interval_trunc(), timestamp_age(), and timestamptz_age().

◆ itmin2interval()

int itmin2interval ( struct pg_itm_in itm_in,
Interval span 
)

Definition at line 2116 of file timestamp.c.

2117 {
2118  int64 total_months = (int64) itm_in->tm_year * MONTHS_PER_YEAR + itm_in->tm_mon;
2119 
2120  if (total_months > INT_MAX || total_months < INT_MIN)
2121  return -1;
2122  span->month = (int32) total_months;
2123  span->day = itm_in->tm_mday;
2124  span->time = itm_in->tm_usec;
2125  return 0;
2126 }
int tm_mon
Definition: timestamp.h:86
int tm_year
Definition: timestamp.h:87
int tm_mday
Definition: timestamp.h:85
int64 tm_usec
Definition: timestamp.h:84

References Interval::day, if(), Interval::month, MONTHS_PER_YEAR, Interval::time, pg_itm_in::tm_mday, pg_itm_in::tm_mon, pg_itm_in::tm_usec, and pg_itm_in::tm_year.

Referenced by interval_in(), and pg_timezone_abbrevs().

◆ SetEpochTimestamp()

Timestamp SetEpochTimestamp ( void  )

Definition at line 2191 of file timestamp.c.

2192 {
2193  Timestamp dt;
2194  struct pg_tm tt,
2195  *tm = &tt;
2196 
2197  GetEpochTime(tm);
2198  /* we don't bother to test for failure ... */
2199  tm2timestamp(tm, 0, NULL, &dt);
2200 
2201  return dt;
2202 } /* SetEpochTimestamp() */
void GetEpochTime(struct pg_tm *tm)
Definition: timestamp.c:2169
int tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result)
Definition: timestamp.c:1998

References GetEpochTime(), tm, and tm2timestamp().

Referenced by dttofmtasc_replace(), PGTYPEStimestamp_from_asc(), timestamp_in(), timestamp_part_common(), timestamptz_in(), and timestamptz_part_common().

◆ time_t_to_timestamptz()

TimestampTz time_t_to_timestamptz ( pg_time_t  tm)

Definition at line 1812 of file timestamp.c.

1813 {
1814  TimestampTz result;
1815 
1816  result = (TimestampTz) tm -
1818  result *= USECS_PER_SEC;
1819 
1820  return result;
1821 }

References POSTGRES_EPOCH_JDATE, SECS_PER_DAY, tm, UNIX_EPOCH_JDATE, and USECS_PER_SEC.

Referenced by pg_control_checkpoint(), pg_control_system(), pg_ls_dir_files(), and pg_stat_file().

◆ timestamp2timestamptz_opt_overflow()

TimestampTz timestamp2timestamptz_opt_overflow ( Timestamp  timestamp,
int *  overflow 
)

Definition at line 6305 of file timestamp.c.

6306 {
6307  TimestampTz result;
6308  struct pg_tm tt,
6309  *tm = &tt;
6310  fsec_t fsec;
6311  int tz;
6312 
6313  if (overflow)
6314  *overflow = 0;
6315 
6317  return timestamp;
6318 
6319  /* We don't expect this to fail, but check it pro forma */
6320  if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) == 0)
6321  {
6323 
6324  result = dt2local(timestamp, -tz);
6325 
6326  if (IS_VALID_TIMESTAMP(result))
6327  {
6328  return result;
6329  }
6330  else if (overflow)
6331  {
6332  if (result < MIN_TIMESTAMP)
6333  {
6334  *overflow = -1;
6335  TIMESTAMP_NOBEGIN(result);
6336  }
6337  else
6338  {
6339  *overflow = 1;
6340  TIMESTAMP_NOEND(result);
6341  }
6342  return result;
6343  }
6344  }
6345 
6346  ereport(ERROR,
6347  (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
6348  errmsg("timestamp out of range")));
6349 
6350  return 0;
6351 }
int DetermineTimeZoneOffset(struct pg_tm *tm, pg_tz *tzp)
Definition: datetime.c:1585
static Timestamp dt2local(Timestamp dt, int timezone)
Definition: timestamp.c:2135
int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone)
Definition: timestamp.c:1902
int32 fsec_t
Definition: timestamp.h:41
#define TIMESTAMP_NOBEGIN(j)
Definition: timestamp.h:159
#define IS_VALID_TIMESTAMP(t)
Definition: timestamp.h:267
#define TIMESTAMP_NOT_FINITE(j)
Definition: timestamp.h:169
#define TIMESTAMP_NOEND(j)
Definition: timestamp.h:164
#define MIN_TIMESTAMP
Definition: timestamp.h:256
PGDLLIMPORT pg_tz * session_timezone
Definition: pgtz.c:28
int64 timestamp

References DetermineTimeZoneOffset(), dt2local(), ereport, errcode(), errmsg(), ERROR, IS_VALID_TIMESTAMP, MIN_TIMESTAMP, session_timezone, timestamp2tm(), TIMESTAMP_NOBEGIN, TIMESTAMP_NOEND, TIMESTAMP_NOT_FINITE, and tm.

Referenced by timestamp2timestamptz(), and timestamp_cmp_timestamptz_internal().

◆ timestamp2tm()

int timestamp2tm ( Timestamp  dt,
int *  tzp,
struct pg_tm tm,
fsec_t fsec,
const char **  tzn,
pg_tz attimezone 
)

Definition at line 1902 of file timestamp.c.

1903 {
1904  Timestamp date;
1905  Timestamp time;
1906  pg_time_t utime;
1907 
1908  /* Use session timezone if caller asks for default */
1909  if (attimezone == NULL)
1910  attimezone = session_timezone;
1911 
1912  time = dt;
1913  TMODULO(time, date, USECS_PER_DAY);
1914 
1915  if (time < INT64CONST(0))
1916  {
1917  time += USECS_PER_DAY;
1918  date -= 1;
1919  }
1920 
1921  /* add offset to go from J2000 back to standard Julian date */
1923 
1924  /* Julian day routine does not work for negative Julian days */
1925  if (date < 0 || date > (Timestamp) INT_MAX)
1926  return -1;
1927 
1928  j2date((int) date, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
1929  dt2time(time, &tm->tm_hour, &tm->tm_min, &tm->tm_sec, fsec);
1930 
1931  /* Done if no TZ conversion wanted */
1932  if (tzp == NULL)
1933  {
1934  tm->tm_isdst = -1;
1935  tm->tm_gmtoff = 0;
1936  tm->tm_zone = NULL;
1937  if (tzn != NULL)
1938  *tzn = NULL;
1939  return 0;
1940  }
1941 
1942  /*
1943  * If the time falls within the range of pg_time_t, use pg_localtime() to
1944  * rotate to the local time zone.
1945  *
1946  * First, convert to an integral timestamp, avoiding possibly
1947  * platform-specific roundoff-in-wrong-direction errors, and adjust to
1948  * Unix epoch. Then see if we can convert to pg_time_t without loss. This
1949  * coding avoids hardwiring any assumptions about the width of pg_time_t,
1950  * so it should behave sanely on machines without int64.
1951  */
1952  dt = (dt - *fsec) / USECS_PER_SEC +
1954  utime = (pg_time_t) dt;
1955  if ((Timestamp) utime == dt)
1956  {
1957  struct pg_tm *tx = pg_localtime(&utime, attimezone);
1958 
1959  tm->tm_year = tx->tm_year + 1900;
1960  tm->tm_mon = tx->tm_mon + 1;
1961  tm->tm_mday = tx->tm_mday;
1962  tm->tm_hour = tx->tm_hour;
1963  tm->tm_min = tx->tm_min;
1964  tm->tm_sec = tx->tm_sec;
1965  tm->tm_isdst = tx->tm_isdst;
1966  tm->tm_gmtoff = tx->tm_gmtoff;
1967  tm->tm_zone = tx->tm_zone;
1968  *tzp = -tm->tm_gmtoff;
1969  if (tzn != NULL)
1970  *tzn = tm->tm_zone;
1971  }
1972  else
1973  {
1974  /*
1975  * When out of range of pg_time_t, treat as GMT
1976  */
1977  *tzp = 0;
1978  /* Mark this as *no* time zone available */
1979  tm->tm_isdst = -1;
1980  tm->tm_gmtoff = 0;
1981  tm->tm_zone = NULL;
1982  if (tzn != NULL)
1983  *tzn = NULL;
1984  }
1985 
1986  return 0;
1987 }
void dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec)
Definition: timestamp.c:1875
#define USECS_PER_DAY
Definition: timestamp.h:131
#define TMODULO(t, q, u)
Definition: datetime.h:248
struct pg_tm * pg_localtime(const pg_time_t *timep, const pg_tz *tz)
Definition: localtime.c:1344
long date
Definition: pgtypes_date.h:9
const char * tm_zone
Definition: pgtime.h:46
int tm_isdst
Definition: pgtime.h:44
long int tm_gmtoff
Definition: pgtime.h:45

References dt2time(), j2date(), pg_localtime(), POSTGRES_EPOCH_JDATE, SECS_PER_DAY, session_timezone, 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, TMODULO, UNIX_EPOCH_JDATE, USECS_PER_DAY, and USECS_PER_SEC.

Referenced by DetermineTimeZoneAbbrevOffsetTS(), GetCurrentTimeUsec(), JsonEncodeDateTime(), make_timestamptz_at_timezone(), map_sql_value_to_xml_value(), PGTYPEStimestamp_add_interval(), PGTYPEStimestamp_fmt_asc(), PGTYPEStimestamp_to_asc(), timestamp2timestamptz_opt_overflow(), timestamp_age(), timestamp_date(), timestamp_out(), timestamp_part_common(), timestamp_pl_interval(), timestamp_recv(), timestamp_time(), timestamp_to_char(), timestamp_trunc(), timestamp_zone(), timestamptz2timestamp(), timestamptz_age(), timestamptz_date(), timestamptz_out(), timestamptz_part_common(), timestamptz_pl_interval_internal(), timestamptz_recv(), timestamptz_time(), timestamptz_timetz(), timestamptz_to_char(), timestamptz_to_str(), timestamptz_trunc_internal(), timestamptz_zone(), and timetz_zone().

◆ timestamp_cmp_internal()

int timestamp_cmp_internal ( Timestamp  dt1,
Timestamp  dt2 
)

◆ timestamp_cmp_timestamptz_internal()

int32 timestamp_cmp_timestamptz_internal ( Timestamp  timestampVal,
TimestampTz  dt2 
)

Definition at line 2326 of file timestamp.c.

2327 {
2328  TimestampTz dt1;
2329  int overflow;
2330 
2331  dt1 = timestamp2timestamptz_opt_overflow(timestampVal, &overflow);
2332  if (overflow > 0)
2333  {
2334  /* dt1 is larger than any finite timestamp, but less than infinity */
2335  return TIMESTAMP_IS_NOEND(dt2) ? -1 : +1;
2336  }
2337  if (overflow < 0)
2338  {
2339  /* dt1 is less than any finite timestamp, but more than -infinity */
2340  return TIMESTAMP_IS_NOBEGIN(dt2) ? +1 : -1;
2341  }
2342 
2343  return timestamptz_cmp_internal(dt1, dt2);
2344 }
TimestampTz timestamp2timestamptz_opt_overflow(Timestamp timestamp, int *overflow)
Definition: timestamp.c:6305
#define TIMESTAMP_IS_NOEND(j)
Definition: timestamp.h:167
#define TIMESTAMP_IS_NOBEGIN(j)
Definition: timestamp.h:162
#define timestamptz_cmp_internal(dt1, dt2)
Definition: timestamp.h:131

References timestamp2timestamptz_opt_overflow(), TIMESTAMP_IS_NOBEGIN, TIMESTAMP_IS_NOEND, and timestamptz_cmp_internal.

Referenced by cmpTimestampToTimestampTz(), timestamp_cmp_timestamptz(), timestamp_eq_timestamptz(), timestamp_ge_timestamptz(), timestamp_gt_timestamptz(), timestamp_le_timestamptz(), timestamp_lt_timestamptz(), timestamp_ne_timestamptz(), timestamptz_cmp_timestamp(), timestamptz_eq_timestamp(), timestamptz_ge_timestamp(), timestamptz_gt_timestamp(), timestamptz_le_timestamp(), timestamptz_lt_timestamp(), and timestamptz_ne_timestamp().

◆ TimestampDifference()

void TimestampDifference ( TimestampTz  start_time,
TimestampTz  stop_time,
long *  secs,
int *  microsecs 
)

Definition at line 1731 of file timestamp.c.

1733 {
1734  TimestampTz diff = stop_time - start_time;
1735 
1736  if (diff <= 0)
1737  {
1738  *secs = 0;
1739  *microsecs = 0;
1740  }
1741  else
1742  {
1743  *secs = (long) (diff / USECS_PER_SEC);
1744  *microsecs = (int) (diff % USECS_PER_SEC);
1745  }
1746 }
static time_t start_time
Definition: pg_ctl.c:95

References start_time, and USECS_PER_SEC.

Referenced by check_log_duration(), has_startup_progress_timeout_expired(), heap_vacuum_rel(), launcher_determine_sleep(), log_disconnections(), LogRecoveryConflict(), pgstat_report_activity(), pgstat_update_dbstats(), ProcSleep(), and schedule_alarm().

◆ TimestampDifferenceExceeds()

◆ TimestampDifferenceMilliseconds()

long TimestampDifferenceMilliseconds ( TimestampTz  start_time,
TimestampTz  stop_time 
)

Definition at line 1767 of file timestamp.c.

1768 {
1769  TimestampTz diff;
1770 
1771  /* Deal with zero or negative elapsed time quickly. */
1772  if (start_time >= stop_time)
1773  return 0;
1774  /* To not fail with timestamp infinities, we must detect overflow. */
1775  if (pg_sub_s64_overflow(stop_time, start_time, &diff))
1776  return (long) INT_MAX;
1777  if (diff >= (INT_MAX * INT64CONST(1000) - 999))
1778  return (long) INT_MAX;
1779  else
1780  return (long) ((diff + 999) / 1000);
1781 }
static bool pg_sub_s64_overflow(int64 a, int64 b, int64 *result)
Definition: int.h:188

References pg_sub_s64_overflow(), and start_time.

Referenced by ApplyLauncherMain(), autoprewarm_main(), bbsink_copystream_archive_contents(), DetermineSleepTime(), do_analyze_rel(), GetReplicationApplyDelay(), GetReplicationTransferLatency(), libpqsrv_cancel(), LogCheckpointEnd(), pgfdw_get_cleanup_result(), PrepareForIncrementalBackup(), recoveryApplyDelay(), WaitForWalSummarization(), WaitForWALToBecomeAvailable(), WalReceiverMain(), and WalSndComputeSleeptime().

◆ TimestampGetDatum()

◆ TimestampTimestampTzRequiresRewrite()

bool TimestampTimestampTzRequiresRewrite ( void  )

Definition at line 6274 of file timestamp.c.

6275 {
6276  long offset;
6277 
6278  if (pg_get_timezone_offset(session_timezone, &offset) && offset == 0)
6279  return false;
6280  return true;
6281 }
bool pg_get_timezone_offset(const pg_tz *tz, long int *gmtoff)
Definition: localtime.c:1851

References pg_get_timezone_offset(), and session_timezone.

Referenced by ATColumnChangeRequiresRewrite().

◆ timestamptz_to_str()

const char* timestamptz_to_str ( TimestampTz  t)

Definition at line 1854 of file timestamp.c.

1855 {
1856  static char buf[MAXDATELEN + 1];
1857  int tz;
1858  struct pg_tm tt,
1859  *tm = &tt;
1860  fsec_t fsec;
1861  const char *tzn;
1862 
1863  if (TIMESTAMP_NOT_FINITE(t))
1865  else if (timestamp2tm(t, &tz, tm, &fsec, &tzn, NULL) == 0)
1866  EncodeDateTime(tm, fsec, true, tz, tzn, USE_ISO_DATES, buf);
1867  else
1868  strlcpy(buf, "(timestamp out of range)", sizeof(buf));
1869 
1870  return buf;
1871 }
void EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str)
Definition: datetime.c:4342
void EncodeSpecialTimestamp(Timestamp dt, char *str)
Definition: timestamp.c:1597
#define MAXDATELEN
Definition: datetime.h:200
#define USE_ISO_DATES
Definition: miscadmin.h:235
static char * buf
Definition: pg_test_fsync.c:73
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: strlcpy.c:45

References buf, EncodeDateTime(), EncodeSpecialTimestamp(), MAXDATELEN, snprintf, strlcpy(), timestamp2tm(), TIMESTAMP_NOT_FINITE, timestamptz_to_time_t(), tm, USE_ISO_DATES, and USECS_PER_SEC.

Referenced by CreateRestartPoint(), getRecoveryStopReason(), InitWalRecovery(), PerformWalRecovery(), pg_decode_commit_prepared_txn(), pg_decode_commit_txn(), pg_decode_prepare_txn(), pg_decode_rollback_prepared_txn(), pg_decode_stream_commit(), pg_decode_stream_prepare(), ProcessStandbyHSFeedbackMessage(), ProcessStandbyReplyMessage(), ProcessWalSndrMessage(), recoveryStopsAfter(), recoveryStopsBefore(), xact_desc_abort(), xact_desc_commit(), xact_desc_prepare(), xlog_desc(), and xlogrecovery_redo().

◆ timestamptz_to_time_t()

pg_time_t timestamptz_to_time_t ( TimestampTz  t)

Definition at line 1834 of file timestamp.c.

1835 {
1836  pg_time_t result;
1837 
1838  result = (pg_time_t) (t / USECS_PER_SEC +
1840 
1841  return result;
1842 }

References POSTGRES_EPOCH_JDATE, SECS_PER_DAY, UNIX_EPOCH_JDATE, and USECS_PER_SEC.

Referenced by DetermineTimeZoneAbbrevOffsetTS(), InitProcessGlobals(), and timestamptz_to_str().

◆ TimestampTzGetDatum()

◆ tm2timestamp()

int tm2timestamp ( struct pg_tm tm,
fsec_t  fsec,
int *  tzp,
Timestamp result 
)

Definition at line 1998 of file timestamp.c.

1999 {
2000  TimeOffset date;
2001  TimeOffset time;
2002 
2003  /* Prevent overflow in Julian-day routines */
2005  {
2006  *result = 0; /* keep compiler quiet */
2007  return -1;
2008  }
2009 
2011  time = time2t(tm->tm_hour, tm->tm_min, tm->tm_sec, fsec);
2012 
2013  *result = date * USECS_PER_DAY + time;
2014  /* check for major overflow */
2015  if ((*result - time) / USECS_PER_DAY != date)
2016  {
2017  *result = 0; /* keep compiler quiet */
2018  return -1;
2019  }
2020  /* check for just-barely overflow (okay except time-of-day wraps) */
2021  /* caution: we want to allow 1999-12-31 24:00:00 */
2022  if ((*result < 0 && date > 0) ||
2023  (*result > 0 && date < -1))
2024  {
2025  *result = 0; /* keep compiler quiet */
2026  return -1;
2027  }
2028  if (tzp != NULL)
2029  *result = dt2local(*result, -(*tzp));
2030 
2031  /* final range check catches just-out-of-range timestamps */
2032  if (!IS_VALID_TIMESTAMP(*result))
2033  {
2034  *result = 0; /* keep compiler quiet */
2035  return -1;
2036  }
2037 
2038  return 0;
2039 }
static TimeOffset time2t(const int hour, const int min, const int sec, const fsec_t fsec)
Definition: timestamp.c:2129
#define IS_VALID_JULIAN(y, m, d)
Definition: timestamp.h:227

References date2j(), dt2local(), IS_VALID_JULIAN, IS_VALID_TIMESTAMP, POSTGRES_EPOCH_JDATE, 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, and USECS_PER_DAY.

Referenced by check_recovery_target_time(), parse_datetime(), PGTYPEStimestamp_add_interval(), PGTYPEStimestamp_current(), PGTYPEStimestamp_defmt_scan(), PGTYPEStimestamp_from_asc(), SetEpochTimestamp(), timestamp_in(), timestamp_pl_interval(), timestamp_trunc(), timestamp_zone(), timestamptz2timestamp(), timestamptz_in(), timestamptz_pl_interval_internal(), timestamptz_trunc_internal(), timestamptz_zone(), and to_timestamp().

Variable Documentation

◆ PgReloadTime

PGDLLIMPORT TimestampTz PgReloadTime
extern

Definition at line 56 of file timestamp.c.

Referenced by pg_conf_load_time(), and ProcessConfigFileInternal().

◆ PgStartTime

PGDLLIMPORT TimestampTz PgStartTime
extern

Definition at line 53 of file timestamp.c.

Referenced by pg_postmaster_start_time(), PostgresSingleUserMain(), and PostmasterMain().