*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.203 2009/03/22 01:12:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.204 2009/05/01 19:29:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*/
/* test for > 24:00:00 */
if (tm->tm_hour > 24 ||
- (tm->tm_hour == 24 && (tm->tm_min > 0 || tm->tm_sec > 0)))
+ (tm->tm_hour == 24 &&
+ (tm->tm_min > 0 || tm->tm_sec > 0 || *fsec > 0)))
return DTERR_FIELD_OVERFLOW;
break;
if (tm->tm_hour < 0 || tm->tm_min < 0 || tm->tm_min > 59 ||
tm->tm_sec < 0 || tm->tm_sec > 60 || tm->tm_hour > 24 ||
- /* test for > 24:00:00 */
+ /* test for > 24:00:00 */
+ (tm->tm_hour == 24 &&
+ (tm->tm_min > 0 || tm->tm_sec > 0 || *fsec > 0)) ||
#ifdef HAVE_INT64_TIMESTAMP
- (tm->tm_hour == 24 && (tm->tm_min > 0 || tm->tm_sec > 0 ||
- *fsec > INT64CONST(0))) ||
- *fsec < INT64CONST(0) || *fsec >= USECS_PER_SEC
+ *fsec < INT64CONST(0) || *fsec > USECS_PER_SEC
#else
- (tm->tm_hour == 24 && (tm->tm_min > 0 || tm->tm_sec > 0 ||
- *fsec > 0)) ||
- *fsec < 0 || *fsec >= 1
+ *fsec < 0 || *fsec > 1
#endif
)
return DTERR_FIELD_OVERFLOW;
#ifdef HAVE_INT64_TIMESTAMP
if (tm->tm_hour < 0 || tm->tm_min < 0 || tm->tm_min > 59 ||
tm->tm_sec < 0 || tm->tm_sec > 60 || *fsec < INT64CONST(0) ||
- *fsec >= USECS_PER_SEC)
+ *fsec > USECS_PER_SEC)
return DTERR_FIELD_OVERFLOW;
#else
if (tm->tm_hour < 0 || tm->tm_min < 0 || tm->tm_min > 59 ||
- tm->tm_sec < 0 || tm->tm_sec > 60 || *fsec < 0 || *fsec >= 1)
+ tm->tm_sec < 0 || tm->tm_sec > 60 || *fsec < 0 || *fsec > 1)
return DTERR_FIELD_OVERFLOW;
#endif