aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/nabstime.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2011-03-12 09:31:18 -0500
committerBruce Momjian <bruce@momjian.us>2011-03-12 09:35:56 -0500
commit3a3f39fdc00c6caa41d795475189ac844403b770 (patch)
tree2cee74a6ad8f09bec94434ce24ff0c30d154b662 /src/backend/utils/adt/nabstime.c
parent3d9f7ec1ffde399accda096da4df46b178e8b960 (diff)
downloadpostgresql-3a3f39fdc00c6caa41d795475189ac844403b770.tar.gz
postgresql-3a3f39fdc00c6caa41d795475189ac844403b770.zip
Use macros for time-based constants, rather than constants.
Diffstat (limited to 'src/backend/utils/adt/nabstime.c')
-rw-r--r--src/backend/utils/adt/nabstime.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c
index 0e25c5fbfe3..4b61b21cbed 100644
--- a/src/backend/utils/adt/nabstime.c
+++ b/src/backend/utils/adt/nabstime.c
@@ -179,13 +179,13 @@ tm2abstime(struct pg_tm * tm, int tz)
/* validate, before going out of range on some members */
if (tm->tm_year < 1901 || tm->tm_year > 2038 ||
- tm->tm_mon < 1 || tm->tm_mon > 12 ||
+ tm->tm_mon < 1 || tm->tm_mon > MONTHS_PER_YEAR ||
tm->tm_mday < 1 || tm->tm_mday > 31 ||
tm->tm_hour < 0 ||
- tm->tm_hour > 24 || /* test for > 24:00:00 */
- (tm->tm_hour == 24 && (tm->tm_min > 0 || tm->tm_sec > 0)) ||
- tm->tm_min < 0 || tm->tm_min > 59 ||
- tm->tm_sec < 0 || tm->tm_sec > 60)
+ tm->tm_hour > HOURS_PER_DAY || /* test for > 24:00:00 */
+ (tm->tm_hour == HOURS_PER_DAY && (tm->tm_min > 0 || tm->tm_sec > 0)) ||
+ tm->tm_min < 0 || tm->tm_min > MINS_PER_HOUR - 1 ||
+ tm->tm_sec < 0 || tm->tm_sec > SECS_PER_MINUTE)
return INVALID_ABSTIME;
day = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - UNIX_EPOCH_JDATE;