<!--
-$PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.160 2005/10/02 23:50:06 tgl Exp $
+$PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.161 2005/10/14 11:47:56 momjian Exp $
-->
<chapter id="datatype">
<entry>8 bytes</entry>
<entry>times of day only</entry>
<entry>00:00:00.00</entry>
- <entry>23:59:59.99</entry>
+ <entry>24:00:00</entry>
<entry>1 microsecond / 14 digits</entry>
</row>
<row>
<entry>12 bytes</entry>
<entry>times of day only, with time zone</entry>
<entry>00:00:00.00+12</entry>
- <entry>23:59:59.99-12</entry>
+ <entry>24:00:00-12</entry>
<entry>1 microsecond / 14 digits</entry>
</row>
</tbody>
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.158 2005/10/09 17:21:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.159 2005/10/14 11:47:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* Check upper limit on hours; other limits checked in
* DecodeTime()
*/
- if (tm->tm_hour > 23)
+ /* test for > 24:00:00 */
+ if (tm->tm_hour > 24 ||
+ (tm->tm_hour == 24 && (tm->tm_min > 0 || tm->tm_sec > 0)))
return DTERR_FIELD_OVERFLOW;
break;
else if (mer == PM && tm->tm_hour != 12)
tm->tm_hour += 12;
+ 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 */
+ (tm->tm_hour == 24 && (tm->tm_min > 0 || tm->tm_sec > 0 ||
#ifdef HAVE_INT64_TIMESTAMP
- if (tm->tm_hour < 0 || tm->tm_hour > 23 || tm->tm_min < 0 ||
- tm->tm_min > 59 || tm->tm_sec < 0 || tm->tm_sec > 60 ||
+ *fsec > INT64CONST(0))) ||
*fsec < INT64CONST(0) || *fsec >= USECS_PER_SEC)
return DTERR_FIELD_OVERFLOW;
#else
- if (tm->tm_hour < 0 || tm->tm_hour > 23 || tm->tm_min < 0 ||
- tm->tm_min > 59 || tm->tm_sec < 0 || tm->tm_sec > 60 ||
+ *fsec > 0)) ||
*fsec < 0 || *fsec >= 1)
return DTERR_FIELD_OVERFLOW;
#endif
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.143 2005/09/24 22:54:38 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.144 2005/10/14 11:47:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
AbsoluteTime sec;
/* 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_mday < 1 || tm->tm_mday > 31
- || tm->tm_hour < 0 || tm->tm_hour > 23
- || tm->tm_min < 0 || tm->tm_min > 59
- || tm->tm_sec < 0 || tm->tm_sec > 60)
+ if (tm->tm_year < 1901 || tm->tm_year > 2038 ||
+ tm->tm_mon < 1 || tm->tm_mon > 12 ||
+ 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)
return INVALID_ABSTIME;
day = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - UNIX_EPOCH_JDATE;
* Check upper limit on hours; other limits checked in
* DecodeTime()
*/
- if (tm->tm_hour > 23)
+ /* test for > 24:00:00 */
+ if (tm->tm_hour > 24 ||
+ (tm->tm_hour == 24 && (tm->tm_min > 0 || tm->tm_sec > 0)))
return -1;
break;
err = 1;
*minute = 0;
}
- if (*hour > 23)
+ if (*hour > 24 || /* test for > 24:00:00 */
+ (*hour == 24 && (*minute > 0 || *second > 0)))
{
err = 1;
*hour = 0;