PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
timestamp.h File Reference
#include <math.h>
#include <limits.h>
#include <float.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.

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   (-DBL_MAX)
 
#define DT_NOEND   (DBL_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   DATE_END_JULIAN
 
#define MIN_TIMESTAMP   (-211813488000.0)
 
#define END_TIMESTAMP   185330760393600.0
 
#define IS_VALID_DATE(d)
 
#define IS_VALID_TIMESTAMP(t)   (MIN_TIMESTAMP <= (t) && (t) < END_TIMESTAMP)
 

Typedefs

typedef double Timestamp
 
typedef double TimestampTz
 
typedef double TimeOffset
 
typedef double fsec_t
 

Macro Definition Documentation

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

Definition at line 204 of file timestamp.h.

#define DATETIME_MIN_JULIAN   (0)

Definition at line 203 of file timestamp.h.

Referenced by float8_timestamptz().

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

Definition at line 80 of file timestamp.h.

Referenced by convert_timevalue_to_scalar(), interval_part(), and interval_reltime().

#define DT_NOBEGIN   (-DBL_MAX)

Definition at line 129 of file timestamp.h.

Referenced by leftmostvalue_interval(), and leftmostvalue_timestamp().

#define DT_NOEND   (DBL_MAX)

Definition at line 130 of file timestamp.h.

#define END_TIMESTAMP   185330760393600.0

Definition at line 220 of file timestamp.h.

#define HOURS_PER_DAY   24 /* assume no daylight savings time changes */
#define IS_VALID_DATE (   d)
Value:
#define DATE_END_JULIAN
Definition: timestamp.h:204
#define POSTGRES_EPOCH_JDATE
Definition: timestamp.h:185
#define DATETIME_MIN_JULIAN
Definition: timestamp.h:203

Definition at line 225 of file timestamp.h.

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

#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:173
#define JULIAN_MAXMONTH
Definition: timestamp.h:174
#define JULIAN_MINMONTH
Definition: timestamp.h:171
#define JULIAN_MINYEAR
Definition: timestamp.h:170

Definition at line 177 of file timestamp.h.

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

#define JULIAN_MAXDAY   (3)

Definition at line 175 of file timestamp.h.

#define JULIAN_MAXMONTH   (6)

Definition at line 174 of file timestamp.h.

#define JULIAN_MAXYEAR   (5874898)

Definition at line 173 of file timestamp.h.

#define JULIAN_MINDAY   (24)

Definition at line 172 of file timestamp.h.

#define JULIAN_MINMONTH   (11)

Definition at line 171 of file timestamp.h.

#define JULIAN_MINYEAR   (-4713)

Definition at line 170 of file timestamp.h.

#define MAX_INTERVAL_PRECISION   6
#define MAX_TIMESTAMP_PRECISION   6
#define MAX_TZDISP_HOUR   15 /* maximum allowed hour part */

Definition at line 115 of file timestamp.h.

Referenced by DecodeTimezone().

#define MIN_TIMESTAMP   (-211813488000.0)

Definition at line 218 of file timestamp.h.

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

Definition at line 97 of file timestamp.h.

Referenced by reltime_interval(), and reltimein().

#define TIMESTAMP_END_JULIAN   DATE_END_JULIAN
#define TIMESTAMP_IS_NOBEGIN (   j)    ((j) == DT_NOBEGIN)
#define TIMESTAMP_IS_NOEND (   j)    ((j) == DT_NOEND)
#define TS_PREC_INV   1000000.0

Definition at line 72 of file timestamp.h.

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

Definition at line 73 of file timestamp.h.

Referenced by interval2tm(), interval_div(), interval_mul(), and timestamp2tm().

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

Definition at line 116 of file timestamp.h.

Referenced by timetz_recv().

#define USECS_PER_HOUR   INT64CONST(3600000000)

Typedef Documentation

typedef double fsec_t

Definition at line 53 of file timestamp.h.

Definition at line 52 of file timestamp.h.

Definition at line 50 of file timestamp.h.

Definition at line 51 of file timestamp.h.