Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a877df

Browse files
committed
Remove DATEDEBUG because it didn't look Y2K safe, and fix timestamp elog
to be Y2K safe.
1 parent eb9bb3d commit 7a877df

File tree

5 files changed

+7
-386
lines changed

5 files changed

+7
-386
lines changed

src/backend/utils/adt/date.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.38 1999/09/21 20:58:25 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.39 2000/01/02 01:37:26 momjian Exp $
1313
*
1414
* NOTES
1515
* This code is actually (almost) unused.
@@ -142,10 +142,6 @@ reltimein(char *str)
142142
|| (DecodeDateDelta(field, ftype, nf, &dtype, tm, &fsec) != 0))
143143
elog(ERROR, "Bad reltime external representation '%s'", str);
144144

145-
#ifdef DATEDEBUG
146-
printf("reltimein- %d fields are type %d (DTK_DATE=%d)\n", nf, dtype, DTK_DATE);
147-
#endif
148-
149145
switch (dtype)
150146
{
151147
case DTK_DELTA:
@@ -351,11 +347,6 @@ timespan_reltime(TimeSpan *timespan)
351347

352348
span = (((((double) 365 * year) + ((double) 30 * month)) * 86400) + timespan->time);
353349

354-
#ifdef DATEDEBUG
355-
printf("timespan_reltime- convert m%d s%f to %f [%d %d]\n",
356-
timespan->month, timespan->time, span, INT_MIN, INT_MAX);
357-
#endif
358-
359350
time = (((span > INT_MIN) && (span < INT_MAX)) ? span : INVALID_RELTIME);
360351
}
361352

src/backend/utils/adt/datetime.c

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.38 1999/07/17 20:17:55 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.39 2000/01/02 01:37:26 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -48,9 +48,6 @@ date_in(char *str)
4848
if (!PointerIsValid(str))
4949
elog(ERROR, "Bad (null) date external representation", NULL);
5050

51-
#ifdef DATEDEBUG
52-
printf("date_in- input string is %s\n", str);
53-
#endif
5451
if ((ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf) != 0)
5552
|| (DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tzp) != 0))
5653
elog(ERROR, "Bad date external representation '%s'", str);
@@ -204,11 +201,6 @@ date_datetime(DateADT dateVal)
204201
if (date2tm(dateVal, &tz, tm, &fsec, &tzn) != 0)
205202
elog(ERROR, "Unable to convert date to datetime", NULL);
206203

207-
#ifdef DATEDEBUG
208-
printf("date_datetime- date is %d.%02d.%02d\n", tm->tm_year, tm->tm_mon, tm->tm_mday);
209-
printf("date_datetime- time is %02d:%02d:%02d %.7f\n", tm->tm_hour, tm->tm_min, tm->tm_sec, fsec);
210-
#endif
211-
212204
if (tm2datetime(tm, fsec, &tz, result) != 0)
213205
elog(ERROR, "Datetime out of range", NULL);
214206

@@ -330,17 +322,6 @@ date2tm(DateADT dateVal, int *tzp, struct tm * tm, double *fsec, char **tzn)
330322
#ifdef USE_POSIX_TIME
331323
tx = localtime(&utime);
332324

333-
#ifdef DATEDEBUG
334-
#if defined(HAVE_TM_ZONE)
335-
printf("date2tm- (localtime) %d.%02d.%02d %02d:%02d:%02.0f %s dst=%d\n",
336-
tx->tm_year, tx->tm_mon, tx->tm_mday, tx->tm_hour, tx->tm_min, (double) tm->tm_sec,
337-
tx->tm_zone, tx->tm_isdst);
338-
#elif defined(HAVE_INT_TIMEZONE)
339-
printf("date2tm- (localtime) %d.%02d.%02d %02d:%02d:%02.0f %s %s dst=%d\n",
340-
tx->tm_year, tx->tm_mon, tx->tm_mday, tx->tm_hour, tx->tm_min, (double) tm->tm_sec,
341-
tzname[0], tzname[1], tx->tm_isdst);
342-
#endif
343-
#endif
344325
tm->tm_year = tx->tm_year + 1900;
345326
tm->tm_mon = tx->tm_mon + 1;
346327
tm->tm_mday = tx->tm_mday;
@@ -375,29 +356,12 @@ date2tm(DateADT dateVal, int *tzp, struct tm * tm, double *fsec, char **tzn)
375356
}
376357
else
377358
{
378-
#ifdef DATEDEBUG
379-
printf("date2tm- convert %d-%d-%d %d:%d%d to datetime\n",
380-
tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
381-
#endif
382-
383359
*tzp = 0;
384360
tm->tm_isdst = 0;
385361
if (tzn != NULL)
386362
*tzn = NULL;
387363
}
388364

389-
#ifdef DATEDEBUG
390-
#if defined(HAVE_TM_ZONE)
391-
printf("date2tm- %d.%02d.%02d %02d:%02d:%02.0f (%d %s) dst=%d\n",
392-
tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, (double) tm->tm_sec,
393-
*tzp, tm->tm_zone, tm->tm_isdst);
394-
#elif defined(HAVE_INT_TIMEZONE)
395-
printf("date2tm- %d.%02d.%02d %02d:%02d:%02.0f (%d %s %s) dst=%d\n",
396-
tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, (double) tm->tm_sec,
397-
*tzp, tzname[0], tzname[1], tm->tm_isdst);
398-
#endif
399-
#endif
400-
401365
return 0;
402366
} /* date2tm() */
403367

0 commit comments

Comments
 (0)