summaryrefslogtreecommitdiff
path: root/src/include/utils/date.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-03-21 01:31:43 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-03-21 01:31:43 +0000
commit2d0583a166402cbed19ba2b85b6c0b9240cff563 (patch)
tree07a7fd1030484b54fc027c9c66db87c545ab08ac /src/include/utils/date.h
parent6b0706ac33ab5da815980c642a9cde9a4cd86b6b (diff)
downloadpostgresql-2d0583a166402cbed19ba2b85b6c0b9240cff563.tar.gz
Get rid of a bunch of #ifdef HAVE_INT64_TIMESTAMP conditionals by inventing
a new typedef TimeOffset to represent an intermediate time value. It's either int64 or double as appropriate, and in most usages will be measured in microseconds or seconds the same as Timestamp. We don't call it Timestamp, though, since the value doesn't necessarily represent an absolute time instant. Warren Turkal
Diffstat (limited to 'src/include/utils/date.h')
-rw-r--r--src/include/utils/date.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/include/utils/date.h b/src/include/utils/date.h
index eca2700ed1..5f23549836 100644
--- a/src/include/utils/date.h
+++ b/src/include/utils/date.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/date.h,v 1.39 2008/01/01 19:45:59 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/date.h,v 1.40 2008/03/21 01:31:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,11 +29,7 @@ typedef float8 TimeADT;
typedef struct
{
-#ifdef HAVE_INT64_TIMESTAMP
- int64 time; /* all time units other than months and years */
-#else
- double time; /* all time units other than months and years */
-#endif
+ TimeADT time; /* all time units other than months and years */
int32 zone; /* numeric time zone, in seconds */
} TimeTzADT;
@@ -54,7 +50,8 @@ typedef struct
#define DateADTGetDatum(X) Int32GetDatum(X)
#define TimeADTGetDatum(X) Int64GetDatum(X)
#define TimeTzADTPGetDatum(X) PointerGetDatum(X)
-#else
+
+#else /* !HAVE_INT64_TIMESTAMP */
#define MAX_TIME_PRECISION 10
@@ -69,6 +66,7 @@ typedef struct
#define DateADTGetDatum(X) Int32GetDatum(X)
#define TimeADTGetDatum(X) Float8GetDatum(X)
#define TimeTzADTPGetDatum(X) PointerGetDatum(X)
+
#endif /* HAVE_INT64_TIMESTAMP */
#define PG_GETARG_DATEADT(n) DatumGetDateADT(PG_GETARG_DATUM(n))