summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/datatype/timestamp.h13
-rw-r--r--src/include/utils/timestamp.h2
2 files changed, 12 insertions, 3 deletions
diff --git a/src/include/datatype/timestamp.h b/src/include/datatype/timestamp.h
index 21a37e21e9b..ab8ccf89ca9 100644
--- a/src/include/datatype/timestamp.h
+++ b/src/include/datatype/timestamp.h
@@ -143,10 +143,17 @@ struct pg_itm_in
#define TZDISP_LIMIT ((MAX_TZDISP_HOUR + 1) * SECS_PER_HOUR)
/*
- * DT_NOBEGIN represents timestamp -infinity; DT_NOEND represents +infinity
+ * We reserve the minimum and maximum integer values to represent
+ * timestamp (or timestamptz) -infinity and +infinity.
*/
-#define DT_NOBEGIN PG_INT64_MIN
-#define DT_NOEND PG_INT64_MAX
+#define TIMESTAMP_MINUS_INFINITY PG_INT64_MIN
+#define TIMESTAMP_INFINITY PG_INT64_MAX
+
+/*
+ * Historically these alias for infinity have been used.
+ */
+#define DT_NOBEGIN TIMESTAMP_MINUS_INFINITY
+#define DT_NOEND TIMESTAMP_INFINITY
#define TIMESTAMP_NOBEGIN(j) \
do {(j) = DT_NOBEGIN;} while (0)
diff --git a/src/include/utils/timestamp.h b/src/include/utils/timestamp.h
index 42f802bb9dc..edd59dc4322 100644
--- a/src/include/utils/timestamp.h
+++ b/src/include/utils/timestamp.h
@@ -81,7 +81,9 @@ IntervalPGetDatum(const Interval *X)
#define INTERVAL_PRECISION(t) ((t) & INTERVAL_PRECISION_MASK)
#define INTERVAL_RANGE(t) (((t) >> 16) & INTERVAL_RANGE_MASK)
+/* Macros for doing timestamp arithmetic without assuming timestamp's units */
#define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) * (int64) 1000))
+#define TimestampTzPlusSeconds(tz,s) ((tz) + ((s) * (int64) 1000000))
/* Set at postmaster start */