PostgreSQL Source Code  git master
timestamp.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Interval
 

Macros

#define MAX_TIMESTAMP_PRECISION   6
 
#define MAX_INTERVAL_PRECISION   6
 
#define TS_PREC_INV   1000000.0
 
#define TSROUND(j)   (rint(((double) (j)) * TS_PREC_INV) / TS_PREC_INV)
 
#define DAYS_PER_YEAR   365.25 /* assumes leap year every four years */
 
#define MONTHS_PER_YEAR   12
 
#define DAYS_PER_MONTH   30 /* assumes exactly 30 days per month */
 
#define HOURS_PER_DAY   24 /* assume no daylight savings time changes */
 
#define SECS_PER_YEAR   (36525 * 864) /* avoid floating-point computation */
 
#define SECS_PER_DAY   86400
 
#define SECS_PER_HOUR   3600
 
#define SECS_PER_MINUTE   60
 
#define MINS_PER_HOUR   60
 
#define USECS_PER_DAY   INT64CONST(86400000000)
 
#define USECS_PER_HOUR   INT64CONST(3600000000)
 
#define USECS_PER_MINUTE   INT64CONST(60000000)
 
#define USECS_PER_SEC   INT64CONST(1000000)
 
#define MAX_TZDISP_HOUR   15 /* maximum allowed hour part */
 
#define TZDISP_LIMIT   ((MAX_TZDISP_HOUR + 1) * SECS_PER_HOUR)
 
#define DT_NOBEGIN   PG_INT64_MIN
 
#define DT_NOEND   PG_INT64_MAX
 
#define TIMESTAMP_NOBEGIN(j)   do {(j) = DT_NOBEGIN;} while (0)
 
#define TIMESTAMP_IS_NOBEGIN(j)   ((j) == DT_NOBEGIN)
 
#define TIMESTAMP_NOEND(j)   do {(j) = DT_NOEND;} while (0)
 
#define TIMESTAMP_IS_NOEND(j)   ((j) == DT_NOEND)
 
#define TIMESTAMP_NOT_FINITE(j)   (TIMESTAMP_IS_NOBEGIN(j) || TIMESTAMP_IS_NOEND(j))
 
#define JULIAN_MINYEAR   (-4713)
 
#define JULIAN_MINMONTH   (11)
 
#define JULIAN_MINDAY   (24)
 
#define JULIAN_MAXYEAR   (5874898)
 
#define JULIAN_MAXMONTH   (6)
 
#define JULIAN_MAXDAY   (3)
 
#define IS_VALID_JULIAN(y, m, d)
 
#define UNIX_EPOCH_JDATE   2440588 /* == date2j(1970, 1, 1) */
 
#define POSTGRES_EPOCH_JDATE   2451545 /* == date2j(2000, 1, 1) */
 
#define DATETIME_MIN_JULIAN   (0)
 
#define DATE_END_JULIAN   (2147483494) /* == date2j(JULIAN_MAXYEAR, 1, 1) */
 
#define TIMESTAMP_END_JULIAN   (109203528) /* == date2j(294277, 1, 1) */
 
#define MIN_TIMESTAMP   INT64CONST(-211813488000000000)
 
#define END_TIMESTAMP   INT64CONST(9223371331200000000)
 
#define IS_VALID_DATE(d)
 
#define IS_VALID_TIMESTAMP(t)   (MIN_TIMESTAMP <= (t) && (t) < END_TIMESTAMP)
 

Typedefs

typedef int64 Timestamp
 
typedef int64 TimestampTz
 
typedef int64 TimeOffset
 
typedef int32 fsec_t
 

Macro Definition Documentation

◆ DATE_END_JULIAN

#define DATE_END_JULIAN   (2147483494) /* == date2j(JULIAN_MAXYEAR, 1, 1) */

Definition at line 180 of file timestamp.h.

◆ DATETIME_MIN_JULIAN

#define DATETIME_MIN_JULIAN   (0)

Definition at line 179 of file timestamp.h.

Referenced by float8_timestamptz().

◆ DAYS_PER_MONTH

#define DAYS_PER_MONTH   30 /* assumes exactly 30 days per month */

◆ DAYS_PER_YEAR

#define DAYS_PER_YEAR   365.25 /* assumes leap year every four years */

Definition at line 68 of file timestamp.h.

Referenced by convert_timevalue_to_scalar(), and interval_part().

◆ DT_NOBEGIN

#define DT_NOBEGIN   PG_INT64_MIN

Definition at line 109 of file timestamp.h.

Referenced by leftmostvalue_interval(), and leftmostvalue_timestamp().

◆ DT_NOEND

#define DT_NOEND   PG_INT64_MAX

Definition at line 110 of file timestamp.h.

◆ END_TIMESTAMP

#define END_TIMESTAMP   INT64CONST(9223371331200000000)

Definition at line 186 of file timestamp.h.

◆ HOURS_PER_DAY

#define HOURS_PER_DAY   24 /* assume no daylight savings time changes */

◆ IS_VALID_DATE

#define IS_VALID_DATE (   d)
Value:
#define DATE_END_JULIAN
Definition: timestamp.h:180
#define POSTGRES_EPOCH_JDATE
Definition: timestamp.h:163
#define DATETIME_MIN_JULIAN
Definition: timestamp.h:179

Definition at line 190 of file timestamp.h.

Referenced by abstime_date(), date_in(), date_mii(), date_pli(), date_recv(), make_date(), and to_date().

◆ IS_VALID_JULIAN

#define IS_VALID_JULIAN (   y,
  m,
 
)
Value:
(((y) > JULIAN_MINYEAR || \
((y) == JULIAN_MINYEAR && ((m) >= JULIAN_MINMONTH))) && \
((y) < JULIAN_MAXYEAR || \
((y) == JULIAN_MAXYEAR && ((m) < JULIAN_MAXMONTH))))
#define JULIAN_MAXYEAR
Definition: timestamp.h:151
#define JULIAN_MAXMONTH
Definition: timestamp.h:152
#define JULIAN_MINMONTH
Definition: timestamp.h:149
#define JULIAN_MINYEAR
Definition: timestamp.h:148

Definition at line 155 of file timestamp.h.

Referenced by abstime_date(), date_in(), DetermineTimeZoneOffsetInternal(), make_date(), make_timestamp_internal(), tm2timestamp(), and to_date().

◆ IS_VALID_TIMESTAMP

◆ JULIAN_MAXDAY

#define JULIAN_MAXDAY   (3)

Definition at line 153 of file timestamp.h.

◆ JULIAN_MAXMONTH

#define JULIAN_MAXMONTH   (6)

Definition at line 152 of file timestamp.h.

◆ JULIAN_MAXYEAR

#define JULIAN_MAXYEAR   (5874898)

Definition at line 151 of file timestamp.h.

◆ JULIAN_MINDAY

#define JULIAN_MINDAY   (24)

Definition at line 150 of file timestamp.h.

◆ JULIAN_MINMONTH

#define JULIAN_MINMONTH   (11)

Definition at line 149 of file timestamp.h.

◆ JULIAN_MINYEAR

#define JULIAN_MINYEAR   (-4713)

Definition at line 148 of file timestamp.h.

◆ MAX_INTERVAL_PRECISION

#define MAX_INTERVAL_PRECISION   6

◆ MAX_TIMESTAMP_PRECISION

#define MAX_TIMESTAMP_PRECISION   6

◆ MAX_TZDISP_HOUR

#define MAX_TZDISP_HOUR   15 /* maximum allowed hour part */

Definition at line 103 of file timestamp.h.

Referenced by DecodeTimezone().

◆ MIN_TIMESTAMP

#define MIN_TIMESTAMP   INT64CONST(-211813488000000000)

Definition at line 184 of file timestamp.h.

◆ MINS_PER_HOUR

◆ MONTHS_PER_YEAR

◆ POSTGRES_EPOCH_JDATE

◆ SECS_PER_DAY

◆ SECS_PER_HOUR

◆ SECS_PER_MINUTE

◆ SECS_PER_YEAR

#define SECS_PER_YEAR   (36525 * 864) /* avoid floating-point computation */

Definition at line 85 of file timestamp.h.

Referenced by reltime_interval(), and reltimein().

◆ TIMESTAMP_END_JULIAN

#define TIMESTAMP_END_JULIAN   (109203528) /* == date2j(294277, 1, 1) */

◆ TIMESTAMP_IS_NOBEGIN

#define TIMESTAMP_IS_NOBEGIN (   j)    ((j) == DT_NOBEGIN)

◆ TIMESTAMP_IS_NOEND

#define TIMESTAMP_IS_NOEND (   j)    ((j) == DT_NOEND)

◆ TIMESTAMP_NOBEGIN

◆ TIMESTAMP_NOEND

◆ TIMESTAMP_NOT_FINITE

◆ TS_PREC_INV

#define TS_PREC_INV   1000000.0

Definition at line 60 of file timestamp.h.

◆ TSROUND

#define TSROUND (   j)    (rint(((double) (j)) * TS_PREC_INV) / TS_PREC_INV)

Definition at line 61 of file timestamp.h.

Referenced by interval_div(), and interval_mul().

◆ TZDISP_LIMIT

#define TZDISP_LIMIT   ((MAX_TZDISP_HOUR + 1) * SECS_PER_HOUR)

Definition at line 104 of file timestamp.h.

Referenced by timetz_recv().

◆ UNIX_EPOCH_JDATE

◆ USECS_PER_DAY

◆ USECS_PER_HOUR

#define USECS_PER_HOUR   INT64CONST(3600000000)

Definition at line 92 of file timestamp.h.

Referenced by AdjustIntervalForTypmod(), dt2time(), interval2tm(), time2tm(), and timetz2tm().

◆ USECS_PER_MINUTE

◆ USECS_PER_SEC

Typedef Documentation

◆ fsec_t

Definition at line 41 of file timestamp.h.

◆ TimeOffset

Definition at line 40 of file timestamp.h.

◆ Timestamp

Definition at line 38 of file timestamp.h.

◆ TimestampTz

Definition at line 39 of file timestamp.h.