*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.52 2001/10/03 05:29:24 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.53 2001/10/03 15:50:48 tgl Exp $
*
*-------------------------------------------------------------------------
*/
static double time2t(const int hour, const int min, const double sec);
static int EncodeSpecialTimestamp(Timestamp dt, char *str);
static Timestamp dt2local(Timestamp dt, int timezone);
-static void
-AdjustTimestampForTypmod(Timestamp *time, int32 typmod);
+static void AdjustTimestampForTypmod(Timestamp *time, int32 typmod);
/*****************************************************************************
result = timestamp;
- if (! TIMESTAMP_NOT_FINITE(result))
- AdjustTimestampForTypmod(&result, typmod);
+ AdjustTimestampForTypmod(&result, typmod);
PG_RETURN_TIMESTAMP(result);
}
static void
AdjustTimestampForTypmod(Timestamp *time, int32 typmod)
{
- if ((typmod >= 0) && (typmod <= 13))
+ if (! TIMESTAMP_NOT_FINITE(*time) &&
+ (typmod >= 0) && (typmod <= 13))
{
static double TimestampScale = 1;
static int32 TimestampTypmod = 0;
*time = (rint(((double) *time)*TimestampScale)/TimestampScale);
}
-
- return;
}
result = timestamp;
- if (! TIMESTAMP_NOT_FINITE(result))
- AdjustTimestampForTypmod(&result, typmod);
+ AdjustTimestampForTypmod(&result, typmod);
PG_RETURN_TIMESTAMPTZ(result);
}