1 /*-------------------------------------------------------------------------
4 * Definitions for the SQL92 "date" and "time" types.
7 * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * $Id: date.h,v 1.8 2001/01/23 01:48:17 momjian Exp $
12 *-------------------------------------------------------------------------
20 typedef int32 DateADT;
22 typedef float8 TimeADT;
26 double time; /* all time units other than months and
28 int zone; /* numeric time zone, in seconds */
32 * Macros for fmgr-callable functions.
34 * For TimeADT, we make use of the same support routines as for float8.
35 * Therefore TimeADT is pass-by-reference if and only if float8 is!
37 #define DatumGetDateADT(X) ((DateADT) DatumGetInt32(X))
38 #define DatumGetTimeADT(X) ((TimeADT) DatumGetFloat8(X))
39 #define DatumGetTimeTzADTP(X) ((TimeTzADT *) DatumGetPointer(X))
41 #define DateADTGetDatum(X) Int32GetDatum(X)
42 #define TimeADTGetDatum(X) Float8GetDatum(X)
43 #define TimeTzADTPGetDatum(X) PointerGetDatum(X)
45 #define PG_GETARG_DATEADT(n) DatumGetDateADT(PG_GETARG_DATUM(n))
46 #define PG_GETARG_TIMEADT(n) DatumGetTimeADT(PG_GETARG_DATUM(n))
47 #define PG_GETARG_TIMETZADT_P(n) DatumGetTimeTzADTP(PG_GETARG_DATUM(n))
49 #define PG_RETURN_DATEADT(x) return DateADTGetDatum(x)
50 #define PG_RETURN_TIMEADT(x) return TimeADTGetDatum(x)
51 #define PG_RETURN_TIMETZADT_P(x) return TimeTzADTPGetDatum(x)
55 extern Datum date_in(PG_FUNCTION_ARGS);
56 extern Datum date_out(PG_FUNCTION_ARGS);
57 extern Datum date_eq(PG_FUNCTION_ARGS);
58 extern Datum date_ne(PG_FUNCTION_ARGS);
59 extern Datum date_lt(PG_FUNCTION_ARGS);
60 extern Datum date_le(PG_FUNCTION_ARGS);
61 extern Datum date_gt(PG_FUNCTION_ARGS);
62 extern Datum date_ge(PG_FUNCTION_ARGS);
63 extern Datum date_cmp(PG_FUNCTION_ARGS);
64 extern Datum date_larger(PG_FUNCTION_ARGS);
65 extern Datum date_smaller(PG_FUNCTION_ARGS);
66 extern Datum date_mi(PG_FUNCTION_ARGS);
67 extern Datum date_pli(PG_FUNCTION_ARGS);
68 extern Datum date_mii(PG_FUNCTION_ARGS);
69 extern Datum date_timestamp(PG_FUNCTION_ARGS);
70 extern Datum timestamp_date(PG_FUNCTION_ARGS);
71 extern Datum datetime_timestamp(PG_FUNCTION_ARGS);
72 extern Datum abstime_date(PG_FUNCTION_ARGS);
73 extern Datum text_date(PG_FUNCTION_ARGS);
74 extern Datum date_text(PG_FUNCTION_ARGS);
76 extern Datum time_in(PG_FUNCTION_ARGS);
77 extern Datum time_out(PG_FUNCTION_ARGS);
78 extern Datum time_eq(PG_FUNCTION_ARGS);
79 extern Datum time_ne(PG_FUNCTION_ARGS);
80 extern Datum time_lt(PG_FUNCTION_ARGS);
81 extern Datum time_le(PG_FUNCTION_ARGS);
82 extern Datum time_gt(PG_FUNCTION_ARGS);
83 extern Datum time_ge(PG_FUNCTION_ARGS);
84 extern Datum time_cmp(PG_FUNCTION_ARGS);
85 extern Datum overlaps_time(PG_FUNCTION_ARGS);
86 extern Datum time_larger(PG_FUNCTION_ARGS);
87 extern Datum time_smaller(PG_FUNCTION_ARGS);
88 extern Datum timestamp_time(PG_FUNCTION_ARGS);
89 extern Datum time_interval(PG_FUNCTION_ARGS);
90 extern Datum interval_time(PG_FUNCTION_ARGS);
91 extern Datum text_time(PG_FUNCTION_ARGS);
92 extern Datum time_text(PG_FUNCTION_ARGS);
93 extern Datum time_pl_interval(PG_FUNCTION_ARGS);
94 extern Datum time_mi_interval(PG_FUNCTION_ARGS);
95 extern Datum interval_pl_time(PG_FUNCTION_ARGS);
97 extern Datum timetz_in(PG_FUNCTION_ARGS);
98 extern Datum timetz_out(PG_FUNCTION_ARGS);
99 extern Datum timetz_eq(PG_FUNCTION_ARGS);
100 extern Datum timetz_ne(PG_FUNCTION_ARGS);
101 extern Datum timetz_lt(PG_FUNCTION_ARGS);
102 extern Datum timetz_le(PG_FUNCTION_ARGS);
103 extern Datum timetz_gt(PG_FUNCTION_ARGS);
104 extern Datum timetz_ge(PG_FUNCTION_ARGS);
105 extern Datum timetz_cmp(PG_FUNCTION_ARGS);
106 extern Datum timetz_hash(PG_FUNCTION_ARGS);
107 extern Datum overlaps_timetz(PG_FUNCTION_ARGS);
108 extern Datum timetz_larger(PG_FUNCTION_ARGS);
109 extern Datum timetz_smaller(PG_FUNCTION_ARGS);
110 extern Datum timestamp_timetz(PG_FUNCTION_ARGS);
111 extern Datum datetimetz_timestamp(PG_FUNCTION_ARGS);
112 extern Datum text_timetz(PG_FUNCTION_ARGS);
113 extern Datum timetz_text(PG_FUNCTION_ARGS);
114 extern Datum timetz_pl_interval(PG_FUNCTION_ARGS);
115 extern Datum timetz_mi_interval(PG_FUNCTION_ARGS);