88 *
99 *
1010 * IDENTIFICATION
11- * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.72 2002/09/04 20:31:27 momjian Exp $
11+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.73 2002/09/21 19:52:41 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
2727#include "utils/nabstime.h"
2828#include "utils/timestamp.h"
2929
30+ /*
31+ * gcc's -ffast-math switch breaks routines that expect exact results from
32+ * expressions like timeval / 3600, where timeval is double.
33+ */
34+ #ifdef __FAST_MATH__
35+ #error -ffast-math is known to break this code
36+ #endif
37+
3038
31- int time2tm (TimeADT time ,struct tm * tm ,fsec_t * fsec );
32- int timetz2tm (TimeTzADT * time ,struct tm * tm ,fsec_t * fsec ,int * tzp );
33- int tm2time (struct tm * tm ,fsec_t fsec ,TimeADT * result );
34- int tm2timetz (struct tm * tm ,fsec_t fsec ,int tz ,TimeTzADT * result );
39+ static int time2tm (TimeADT time ,struct tm * tm ,fsec_t * fsec );
40+ static int timetz2tm (TimeTzADT * time ,struct tm * tm ,fsec_t * fsec ,int * tzp );
41+ static int tm2time (struct tm * tm ,fsec_t fsec ,TimeADT * result );
42+ static int tm2timetz (struct tm * tm ,fsec_t fsec ,int tz ,TimeTzADT * result );
3543static void AdjustTimeForTypmod (TimeADT * time ,int32 typmod );
3644
3745/*****************************************************************************
@@ -525,7 +533,7 @@ time_in(PG_FUNCTION_ARGS)
525533/* tm2time()
526534 * Convert a tm structure to a time data type.
527535 */
528- int
536+ static int
529537tm2time (struct tm * tm ,fsec_t fsec ,TimeADT * result )
530538{
531539#ifdef HAVE_INT64_TIMESTAMP
@@ -542,7 +550,7 @@ tm2time(struct tm * tm, fsec_t fsec, TimeADT *result)
542550 * For dates within the system-supported time_t range, convert to the
543551 *local time zone. If out of this range, leave as GMT. - tgl 97/05/27
544552 */
545- int
553+ static int
546554time2tm (TimeADT time ,struct tm * tm ,fsec_t * fsec )
547555{
548556#ifdef HAVE_INT64_TIMESTAMP
@@ -1285,7 +1293,7 @@ time_part(PG_FUNCTION_ARGS)
12851293/* tm2timetz()
12861294 * Convert a tm structure to a time data type.
12871295 */
1288- int
1296+ static int
12891297tm2timetz (struct tm * tm ,fsec_t fsec ,int tz ,TimeTzADT * result )
12901298{
12911299#ifdef HAVE_INT64_TIMESTAMP
@@ -1357,7 +1365,7 @@ timetz_out(PG_FUNCTION_ARGS)
13571365 * For dates within the system-supported time_t range, convert to the
13581366 *local time zone. If out of this range, leave as GMT. - tgl 97/05/27
13591367 */
1360- int
1368+ static int
13611369timetz2tm (TimeTzADT * time ,struct tm * tm ,fsec_t * fsec ,int * tzp )
13621370{
13631371#ifdef HAVE_INT64_TIMESTAMP