| 1 | /*------------------------------------------------------------------------- | 
|---|
| 2 | * | 
|---|
| 3 | * datetime.h | 
|---|
| 4 | *	  Definitions for date/time support code. | 
|---|
| 5 | *	  The support code is shared with other date data types, | 
|---|
| 6 | *	   including abstime, reltime, date, and time. | 
|---|
| 7 | * | 
|---|
| 8 | * | 
|---|
| 9 | * Portions Copyright (c) 1996-2015, PostgreSQL Global Development PGGroup | 
|---|
| 10 | * Portions Copyright (c) 1994, Regents of the University of California | 
|---|
| 11 | * | 
|---|
| 12 | * src/include/utils/datetime.h | 
|---|
| 13 | * | 
|---|
| 14 | *------------------------------------------------------------------------- | 
|---|
| 15 | */ | 
|---|
| 16 | #pragma once | 
|---|
| 17 |  | 
|---|
| 18 | #include "nodes/nodes.hpp" | 
|---|
| 19 | #include "utils/timestamp.hpp" | 
|---|
| 20 |  | 
|---|
| 21 |  | 
|---|
| 22 | /* | 
|---|
| 23 | * Field types for time decoding. | 
|---|
| 24 | * | 
|---|
| 25 | * Can't have more of these than there are bits in an unsigned int | 
|---|
| 26 | * since these are turned into bit masks during parsing and decoding. | 
|---|
| 27 | * | 
|---|
| 28 | * Furthermore, the values for YEAR, MONTH, DAY, HOUR, MINUTE, SECOND | 
|---|
| 29 | * must be in the range 0..14 so that the associated bitmasks can fit | 
|---|
| 30 | * into the left half of an INTERVAL's typmod value.  Since those bits | 
|---|
| 31 | * are stored in typmods, you can't change them without initdb! | 
|---|
| 32 | */ | 
|---|
| 33 |  | 
|---|
| 34 | #define RESERV	0 | 
|---|
| 35 | #define MONTH	1 | 
|---|
| 36 | #define YEAR	2 | 
|---|
| 37 | #define DAY		3 | 
|---|
| 38 | #define JULIAN	4 | 
|---|
| 39 | #define TZ		5				/* fixed-offset timezone abbreviation */ | 
|---|
| 40 | #define DTZ		6				/* fixed-offset timezone abbrev, DST */ | 
|---|
| 41 | #define DYNTZ	7				/* dynamic timezone abbreviation */ | 
|---|
| 42 | #define IGNORE_DTF	8 | 
|---|
| 43 | #define AMPM	9 | 
|---|
| 44 | #define HOUR	10 | 
|---|
| 45 | #define MINUTE	11 | 
|---|
| 46 | #define SECOND	12 | 
|---|
| 47 | #define MILLISECOND 13 | 
|---|
| 48 | #define MICROSECOND 14 | 
|---|
| 49 | #define DOY		15 | 
|---|
| 50 | #define DOW		16 | 
|---|
| 51 | #define UNITS	17 | 
|---|
| 52 | #define ADBC	18 | 
|---|
| 53 | /* these are only for relative dates */ | 
|---|
| 54 | #define AGO		19 | 
|---|
| 55 | #define ABS_BEFORE		20 | 
|---|
| 56 | #define ABS_AFTER		21 | 
|---|
| 57 | /* generic fields to help with parsing */ | 
|---|
| 58 | #define ISODATE 22 | 
|---|
| 59 | #define ISOTIME 23 | 
|---|
| 60 | /* these are only for parsing intervals */ | 
|---|
| 61 | #define WEEK		24 | 
|---|
| 62 | #define DECADE		25 | 
|---|
| 63 | #define CENTURY		26 | 
|---|
| 64 | #define MILLENNIUM	27 | 
|---|
| 65 | /* hack for parsing two-word timezone specs "MET DST" etc */ | 
|---|
| 66 | #define DTZMOD	28				/* "DST" as a separate word */ | 
|---|
| 67 | /* reserved for unrecognized string values */ | 
|---|
| 68 | #define UNKNOWN_FIELD	31 | 
|---|
| 69 |  | 
|---|
| 70 |  | 
|---|
| 71 |  | 
|---|