Hello, I have created the following patch in an effort to start cleaning up the timestamp datatype. Please let me know if something like this will help so that I know whether to keep going. BTW, it passes a "make check" AFAICT.
Thanks, wt >From aa573956233e20da4f8230e9fddb936a92c7e814 Mon Sep 17 00:00:00 2001 From: Warren Turkal <[EMAIL PROTECTED]> Date: Thu, 3 Jan 2008 19:59:51 -0800 Subject: [PATCH] Add typedefs for hour and minute types. The HAVE_INT64_TIMESTAMP define was being used to select the types for the hour and minute field variables. I changed them to use a typedef to make the code more readable. --- src/backend/utils/adt/timestamp.c | 18 +++--------------- src/include/utils/timestamp.h | 6 ++++-- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c index 2883caf..dfb9867 100644 --- a/src/backend/utils/adt/timestamp.c +++ b/src/backend/utils/adt/timestamp.c @@ -977,11 +977,7 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) } else if (range == INTERVAL_MASK(MINUTE)) { -#ifdef HAVE_INT64_TIMESTAMP - int64 hour; -#else - double hour; -#endif + fhour_t hour; interval->month = 0; interval->day = 0; @@ -998,11 +994,7 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) } else if (range == INTERVAL_MASK(SECOND)) { -#ifdef HAVE_INT64_TIMESTAMP - int64 minute; -#else - double minute; -#endif + fminute_t minute; interval->month = 0; interval->day = 0; @@ -1076,11 +1068,7 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) else if (range == (INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND))) { -#ifdef HAVE_INT64_TIMESTAMP - int64 hour; -#else - double hour; -#endif + fhour_t hour; interval->month = 0; interval->day = 0; diff --git a/src/include/utils/timestamp.h b/src/include/utils/timestamp.h index 6eec76d..c4eb04f 100644 --- a/src/include/utils/timestamp.h +++ b/src/include/utils/timestamp.h @@ -155,10 +155,12 @@ typedef struct #define TIMESTAMP_NOT_FINITE(j) (TIMESTAMP_IS_NOBEGIN(j) || TIMESTAMP_IS_NOEND(j)) #ifdef HAVE_INT64_TIMESTAMP - +typedef int64 fhour_t; +typedef int64 fminute_t; typedef int32 fsec_t; #else - +typedef double fhour_t; +typedef double fminute_t; typedef double fsec_t; #endif -- 1.5.3.7 ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings