1 | /*------------------------------------------------------------------------- |
2 | * |
3 | * timestamp.h |
4 | * Definitions for the SQL "timestamp" and "interval" types. |
5 | * |
6 | * Portions Copyright (c) 1996-2015, PostgreSQL Global Development PGGroup |
7 | * Portions Copyright (c) 1994, Regents of the University of California |
8 | * |
9 | * src/include/utils/timestamp.h |
10 | * |
11 | *------------------------------------------------------------------------- |
12 | */ |
13 | #pragma once |
14 | |
15 | #include "datatype/timestamp.hpp" |
16 | #include "fmgr.hpp" |
17 | #include "pgtime.hpp" |
18 | |
19 | /* Macros to handle packing and unpacking the typmod field for intervals */ |
20 | #define INTERVAL_FULL_RANGE (0x7FFF) |
21 | #define INTERVAL_RANGE_MASK (0x7FFF) |
22 | #define INTERVAL_FULL_PRECISION (0xFFFF) |
23 | #define INTERVAL_PRECISION_MASK (0xFFFF) |
24 | #define INTERVAL_TYPMOD(p,r) ((((r) & INTERVAL_RANGE_MASK) << 16) | ((p) & INTERVAL_PRECISION_MASK)) |
25 | #define INTERVAL_PRECISION(t) ((t) & INTERVAL_PRECISION_MASK) |
26 | #define INTERVAL_RANGE(t) (((t) >> 16) & INTERVAL_RANGE_MASK) |
27 | |