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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedJan 4, '08 at 3:59a
activeJan 4, '08 at 3:59a
posts1
users1
websitepostgresql.org...
irc#postgresql

1 user in discussion

Warren Turkal: 1 post

People

Translate

site design / logo © 2021 Grokbase