*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.72 2002/09/04 20:31:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.73 2002/09/21 19:52:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "utils/nabstime.h"
#include "utils/timestamp.h"
+/*
+ * gcc's -ffast-math switch breaks routines that expect exact results from
+ * expressions like timeval / 3600, where timeval is double.
+ */
+#ifdef __FAST_MATH__
+#error -ffast-math is known to break this code
+#endif
+
-int time2tm(TimeADT time, struct tm * tm, fsec_t *fsec);
-int timetz2tm(TimeTzADT *time, struct tm * tm, fsec_t *fsec, int *tzp);
-int tm2time(struct tm * tm, fsec_t fsec, TimeADT *result);
-int tm2timetz(struct tm * tm, fsec_t fsec, int tz, TimeTzADT *result);
+static int time2tm(TimeADT time, struct tm * tm, fsec_t *fsec);
+static int timetz2tm(TimeTzADT *time, struct tm * tm, fsec_t *fsec, int *tzp);
+static int tm2time(struct tm * tm, fsec_t fsec, TimeADT *result);
+static int tm2timetz(struct tm * tm, fsec_t fsec, int tz, TimeTzADT *result);
static void AdjustTimeForTypmod(TimeADT *time, int32 typmod);
/*****************************************************************************
/* tm2time()
* Convert a tm structure to a time data type.
*/
-int
+static int
tm2time(struct tm * tm, fsec_t fsec, TimeADT *result)
{
#ifdef HAVE_INT64_TIMESTAMP
* For dates within the system-supported time_t range, convert to the
* local time zone. If out of this range, leave as GMT. - tgl 97/05/27
*/
-int
+static int
time2tm(TimeADT time, struct tm * tm, fsec_t *fsec)
{
#ifdef HAVE_INT64_TIMESTAMP
/* tm2timetz()
* Convert a tm structure to a time data type.
*/
-int
+static int
tm2timetz(struct tm * tm, fsec_t fsec, int tz, TimeTzADT *result)
{
#ifdef HAVE_INT64_TIMESTAMP
* For dates within the system-supported time_t range, convert to the
* local time zone. If out of this range, leave as GMT. - tgl 97/05/27
*/
-int
+static int
timetz2tm(TimeTzADT *time, struct tm * tm, fsec_t *fsec, int *tzp)
{
#ifdef HAVE_INT64_TIMESTAMP
/*-------------------------------------------------------------------------
*
* timestamp.c
- * Functions for the built-in SQL92 type "timestamp" and "interval".
+ * Functions for the built-in SQL92 types "timestamp" and "interval".
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.73 2002/09/04 20:31:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.74 2002/09/21 19:52:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "utils/array.h"
#include "utils/builtins.h"
+/*
+ * gcc's -ffast-math switch breaks routines that expect exact results from
+ * expressions like timeval / 3600, where timeval is double.
+ */
+#ifdef __FAST_MATH__
+#error -ffast-math is known to break this code
+#endif
+
#ifdef HAVE_INT64_TIMESTAMP
static int64 time2t(const int hour, const int min, const int sec, const fsec_t fsec);