diff options
Diffstat (limited to 'src/backend/utils/adt/nabstime.c')
-rw-r--r-- | src/backend/utils/adt/nabstime.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c index 74d24aa0651..a6d30851df9 100644 --- a/src/backend/utils/adt/nabstime.c +++ b/src/backend/utils/adt/nabstime.c @@ -118,26 +118,24 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm * tm, char **tzn) if (tzp != NULL) { - *tzp = -tm->tm_gmtoff; /* tm_gmtoff is Sun/DEC-ism */ + *tzp = -tm->tm_gmtoff; /* tm_gmtoff is Sun/DEC-ism */ + /* + * XXX FreeBSD man pages indicate that this should work - tgl 97/04/23 + */ + if (tzn != NULL) + { /* - * XXX FreeBSD man pages indicate that this should work - tgl - * 97/04/23 + * Copy no more than MAXTZLEN bytes of timezone to tzn, in case it + * contains an error message, which doesn't fit in the buffer */ - if (tzn != NULL) - { - /* - * Copy no more than MAXTZLEN bytes of timezone to tzn, in - * case it contains an error message, which doesn't fit in the - * buffer - */ - StrNCpy(*tzn, tm->tm_zone, MAXTZLEN + 1); - if (strlen(tm->tm_zone) > MAXTZLEN) - ereport(WARNING, - (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid time zone name: \"%s\"", - tm->tm_zone))); - } + StrNCpy(*tzn, tm->tm_zone, MAXTZLEN + 1); + if (strlen(tm->tm_zone) > MAXTZLEN) + ereport(WARNING, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("invalid time zone name: \"%s\"", + tm->tm_zone))); + } } else tm->tm_isdst = -1; @@ -175,7 +173,7 @@ tm2abstime(struct pg_tm * tm, int tz) sec = tm->tm_sec + tz + (tm->tm_min + (day * HOURS_PER_DAY + tm->tm_hour) * MINS_PER_HOUR) * SECS_PER_MINUTE; /* - * check for overflow. We need a little slop here because the H/M/S plus + * check for overflow. We need a little slop here because the H/M/S plus * TZ offset could add up to more than 1 day. */ if ((day >= MAX_DAYNUM - 10 && sec < 0) || @@ -1140,7 +1138,7 @@ tintervalsame(PG_FUNCTION_ARGS) * 1. The interval length computations overflow at 2^31 seconds, causing * intervals longer than that to sort oddly compared to those shorter. * 2. infinity and minus infinity (NOEND_ABSTIME and NOSTART_ABSTIME) are - * just ordinary integers. Since this code doesn't handle them specially, + * just ordinary integers. Since this code doesn't handle them specially, * it's possible for [a b] to be considered longer than [c infinity] for * finite abstimes a, b, c. In combination with the previous point, the * interval [-infinity infinity] is treated as being shorter than many finite |