7
7
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
10
- * $PostgreSQL: pgsql/src/include/utils/date.h,v 1.29 2004/12/31 22:03:45 pgsql Exp $
10
+ * $PostgreSQL: pgsql/src/include/utils/date.h,v 1.30 2005/02/25 16:13:29 teodor Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -38,18 +38,28 @@ typedef struct
38
38
int32 zone ; /* numeric time zone, in seconds */
39
39
} TimeTzADT ;
40
40
41
+ /*
42
+ * Macros for fmgr-callable functions.
43
+ *
44
+ * For TimeADT, we make use of the same support routines as for float8 or int64.
45
+ * Therefore TimeADT is pass-by-reference if and only if float8 or int64 is!
46
+ */
41
47
#ifdef HAVE_INT64_TIMESTAMP
48
+
42
49
#define MAX_TIME_PRECISION 6
50
+
51
+ #define DatumGetDateADT (X ) ((DateADT) DatumGetInt32(X))
52
+ #define DatumGetTimeADT (X ) ((TimeADT) DatumGetInt64(X))
53
+ #define DatumGetTimeTzADTP (X ) ((TimeTzADT *) DatumGetPointer(X))
54
+
55
+ #define DateADTGetDatum (X ) Int32GetDatum(X)
56
+ #define TimeADTGetDatum (X ) Int64GetDatum(X)
57
+ #define TimeTzADTPGetDatum (X ) PointerGetDatum(X)
58
+
43
59
#else
60
+
44
61
#define MAX_TIME_PRECISION 10
45
- #endif
46
62
47
- /*
48
- * Macros for fmgr-callable functions.
49
- *
50
- * For TimeADT, we make use of the same support routines as for float8.
51
- * Therefore TimeADT is pass-by-reference if and only if float8 is!
52
- */
53
63
#define DatumGetDateADT (X ) ((DateADT) DatumGetInt32(X))
54
64
#define DatumGetTimeADT (X ) ((TimeADT) DatumGetFloat8(X))
55
65
#define DatumGetTimeTzADTP (X ) ((TimeTzADT *) DatumGetPointer(X))
@@ -58,6 +68,8 @@ typedef struct
58
68
#define TimeADTGetDatum (X ) Float8GetDatum(X)
59
69
#define TimeTzADTPGetDatum (X ) PointerGetDatum(X)
60
70
71
+ #endif /* HAVE_INT64_TIMESTAMP */
72
+
61
73
#define PG_GETARG_DATEADT (n ) DatumGetDateADT(PG_GETARG_DATUM(n))
62
74
#define PG_GETARG_TIMEADT (n ) DatumGetTimeADT(PG_GETARG_DATUM(n))
63
75
#define PG_GETARG_TIMETZADT_P (n ) DatumGetTimeTzADTP(PG_GETARG_DATUM(n))
0 commit comments