Commit 87581343 authored by Bruce Momjian's avatar Bruce Momjian

Remove excess parens, use Abs instead of : ?.

parent 2e9c04ee
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.139 2005/04/20 17:14:50 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.140 2005/05/21 03:38:05 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1551,7 +1551,7 @@ DecodeDateTime(char **field, int *ftype, int nf, ...@@ -1551,7 +1551,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
return DTERR_FIELD_OVERFLOW; return DTERR_FIELD_OVERFLOW;
/* timezone not specified? then find local timezone if possible */ /* timezone not specified? then find local timezone if possible */
if ((tzp != NULL) && (!(fmask & DTK_M(TZ)))) if (tzp != NULL && !(fmask & DTK_M(TZ)))
{ {
/* /*
* daylight savings time modifier but no standard timezone? * daylight savings time modifier but no standard timezone?
...@@ -2205,7 +2205,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf, ...@@ -2205,7 +2205,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
return DTERR_BAD_FORMAT; return DTERR_BAD_FORMAT;
/* timezone not specified? then find local timezone if possible */ /* timezone not specified? then find local timezone if possible */
if ((tzp != NULL) && (!(fmask & DTK_M(TZ)))) if (tzp != NULL && !(fmask & DTK_M(TZ)))
{ {
struct pg_tm tt, struct pg_tm tt,
*tmp = &tt; *tmp = &tt;
...@@ -3533,7 +3533,7 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, ...@@ -3533,7 +3533,7 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style,
* have alpha time zone info available. tm_isdst != -1 * have alpha time zone info available. tm_isdst != -1
* indicates that we have a valid time zone translation. * indicates that we have a valid time zone translation.
*/ */
if ((tzp != NULL) && (tm->tm_isdst >= 0)) if (tzp != NULL && tm->tm_isdst >= 0)
{ {
hour = -(*tzp / 3600); hour = -(*tzp / 3600);
min = ((abs(*tzp) / 60) % 60); min = ((abs(*tzp) / 60) % 60);
...@@ -3579,7 +3579,7 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, ...@@ -3579,7 +3579,7 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style,
else else
sprintf((str + strlen(str)), ":%02d", tm->tm_sec); sprintf((str + strlen(str)), ":%02d", tm->tm_sec);
if ((tzp != NULL) && (tm->tm_isdst >= 0)) if (tzp != NULL && tm->tm_isdst >= 0)
{ {
if (*tzn != NULL) if (*tzn != NULL)
sprintf((str + strlen(str)), " %.*s", MAXTZLEN, *tzn); sprintf((str + strlen(str)), " %.*s", MAXTZLEN, *tzn);
...@@ -3627,7 +3627,7 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, ...@@ -3627,7 +3627,7 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style,
else else
sprintf((str + strlen(str)), ":%02d", tm->tm_sec); sprintf((str + strlen(str)), ":%02d", tm->tm_sec);
if ((tzp != NULL) && (tm->tm_isdst >= 0)) if (tzp != NULL && tm->tm_isdst >= 0)
{ {
if (*tzn != NULL) if (*tzn != NULL)
sprintf((str + strlen(str)), " %.*s", MAXTZLEN, *tzn); sprintf((str + strlen(str)), " %.*s", MAXTZLEN, *tzn);
...@@ -3686,7 +3686,7 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, ...@@ -3686,7 +3686,7 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style,
sprintf((str + strlen(str)), " %04d", sprintf((str + strlen(str)), " %04d",
((tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1))); ((tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1)));
if ((tzp != NULL) && (tm->tm_isdst >= 0)) if (tzp != NULL && tm->tm_isdst >= 0)
{ {
if (*tzn != NULL) if (*tzn != NULL)
sprintf((str + strlen(str)), " %.*s", MAXTZLEN, *tzn); sprintf((str + strlen(str)), " %.*s", MAXTZLEN, *tzn);
...@@ -3787,7 +3787,7 @@ EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str) ...@@ -3787,7 +3787,7 @@ EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str)
#ifdef HAVE_INT64_TIMESTAMP #ifdef HAVE_INT64_TIMESTAMP
sprintf(cp, ":%02d", abs(tm->tm_sec)); sprintf(cp, ":%02d", abs(tm->tm_sec));
cp += strlen(cp); cp += strlen(cp);
sprintf(cp, ".%06d", ((fsec >= 0) ? fsec : -(fsec))); sprintf(cp, ".%06d", Abs(fsec));
#else #else
fsec += tm->tm_sec; fsec += tm->tm_sec;
sprintf(cp, ":%013.10f", fabs(fsec)); sprintf(cp, ":%013.10f", fabs(fsec));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment