Commit 7a877dfd authored by Bruce Momjian's avatar Bruce Momjian

Remove DATEDEBUG because it didn't look Y2K safe, and fix timestamp elog

to be Y2K safe.
parent eb9bb3de
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.38 1999/09/21 20:58:25 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.39 2000/01/02 01:37:26 momjian Exp $
*
* NOTES
* This code is actually (almost) unused.
......@@ -142,10 +142,6 @@ reltimein(char *str)
|| (DecodeDateDelta(field, ftype, nf, &dtype, tm, &fsec) != 0))
elog(ERROR, "Bad reltime external representation '%s'", str);
#ifdef DATEDEBUG
printf("reltimein- %d fields are type %d (DTK_DATE=%d)\n", nf, dtype, DTK_DATE);
#endif
switch (dtype)
{
case DTK_DELTA:
......@@ -351,11 +347,6 @@ timespan_reltime(TimeSpan *timespan)
span = (((((double) 365 * year) + ((double) 30 * month)) * 86400) + timespan->time);
#ifdef DATEDEBUG
printf("timespan_reltime- convert m%d s%f to %f [%d %d]\n",
timespan->month, timespan->time, span, INT_MIN, INT_MAX);
#endif
time = (((span > INT_MIN) && (span < INT_MAX)) ? span : INVALID_RELTIME);
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.38 1999/07/17 20:17:55 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.39 2000/01/02 01:37:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -48,9 +48,6 @@ date_in(char *str)
if (!PointerIsValid(str))
elog(ERROR, "Bad (null) date external representation", NULL);
#ifdef DATEDEBUG
printf("date_in- input string is %s\n", str);
#endif
if ((ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf) != 0)
|| (DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tzp) != 0))
elog(ERROR, "Bad date external representation '%s'", str);
......@@ -204,11 +201,6 @@ date_datetime(DateADT dateVal)
if (date2tm(dateVal, &tz, tm, &fsec, &tzn) != 0)
elog(ERROR, "Unable to convert date to datetime", NULL);
#ifdef DATEDEBUG
printf("date_datetime- date is %d.%02d.%02d\n", tm->tm_year, tm->tm_mon, tm->tm_mday);
printf("date_datetime- time is %02d:%02d:%02d %.7f\n", tm->tm_hour, tm->tm_min, tm->tm_sec, fsec);
#endif
if (tm2datetime(tm, fsec, &tz, result) != 0)
elog(ERROR, "Datetime out of range", NULL);
......@@ -330,17 +322,6 @@ date2tm(DateADT dateVal, int *tzp, struct tm * tm, double *fsec, char **tzn)
#ifdef USE_POSIX_TIME
tx = localtime(&utime);
#ifdef DATEDEBUG
#if defined(HAVE_TM_ZONE)
printf("date2tm- (localtime) %d.%02d.%02d %02d:%02d:%02.0f %s dst=%d\n",
tx->tm_year, tx->tm_mon, tx->tm_mday, tx->tm_hour, tx->tm_min, (double) tm->tm_sec,
tx->tm_zone, tx->tm_isdst);
#elif defined(HAVE_INT_TIMEZONE)
printf("date2tm- (localtime) %d.%02d.%02d %02d:%02d:%02.0f %s %s dst=%d\n",
tx->tm_year, tx->tm_mon, tx->tm_mday, tx->tm_hour, tx->tm_min, (double) tm->tm_sec,
tzname[0], tzname[1], tx->tm_isdst);
#endif
#endif
tm->tm_year = tx->tm_year + 1900;
tm->tm_mon = tx->tm_mon + 1;
tm->tm_mday = tx->tm_mday;
......@@ -375,29 +356,12 @@ date2tm(DateADT dateVal, int *tzp, struct tm * tm, double *fsec, char **tzn)
}
else
{
#ifdef DATEDEBUG
printf("date2tm- convert %d-%d-%d %d:%d%d to datetime\n",
tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
#endif
*tzp = 0;
tm->tm_isdst = 0;
if (tzn != NULL)
*tzn = NULL;
}
#ifdef DATEDEBUG
#if defined(HAVE_TM_ZONE)
printf("date2tm- %d.%02d.%02d %02d:%02d:%02.0f (%d %s) dst=%d\n",
tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, (double) tm->tm_sec,
*tzp, tm->tm_zone, tm->tm_isdst);
#elif defined(HAVE_INT_TIMEZONE)
printf("date2tm- %d.%02d.%02d %02d:%02d:%02.0f (%d %s %s) dst=%d\n",
tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, (double) tm->tm_sec,
*tzp, tzname[0], tzname[1], tm->tm_isdst);
#endif
#endif
return 0;
} /* date2tm() */
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: nabstime.c,v 1.62 1999/12/09 05:02:24 momjian Exp $
* $Id: nabstime.c,v 1.63 2000/01/02 01:37:27 momjian Exp $
*
*/
#include <ctype.h>
......@@ -103,11 +103,6 @@ GetCurrentAbsoluteTime(void)
#endif
};
#ifdef DATEDEBUG
printf("GetCurrentAbsoluteTime- timezone is %s -> %d seconds from UTC\n",
CTZName, CTimeZone);
#endif
return (AbsoluteTime) now;
} /* GetCurrentAbsoluteTime() */
......@@ -144,18 +139,6 @@ abstime2tm(AbsoluteTime time, int *tzp, struct tm * tm, char *tzn)
};
#endif
#if defined(DATEDEBUG)
#if defined(HAVE_TM_ZONE)
printf("datetime2tm- (localtime) %d.%02d.%02d %02d:%02d:%02d %s dst=%d\n",
tx->tm_year, tx->tm_mon, tx->tm_mday, tx->tm_hour, tx->tm_min, tx->tm_sec,
tx->tm_zone, tx->tm_isdst);
#elif defined(HAVE_INT_TIMEZONE)
printf("datetime2tm- (localtime) %d.%02d.%02d %02d:%02d:%02d %s %s dst=%d\n",
tx->tm_year, tx->tm_mon, tx->tm_mday, tx->tm_hour, tx->tm_min, tx->tm_sec,
tzname[0], tzname[1], tx->tm_isdst);
#endif
#endif
#ifdef USE_POSIX_TIME
tm->tm_year = tx->tm_year + 1900;
......@@ -291,10 +274,6 @@ nabstimein(char *str)
|| (DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tz) != 0))
elog(ERROR, "Bad abstime external representation '%s'", str);
#ifdef DATEDEBUG
printf("nabstimein- %d fields are type %d (DTK_DATE=%d)\n", nf, dtype, DTK_DATE);
#endif
switch (dtype)
{
case DTK_DATE:
......
......@@ -233,8 +233,8 @@ tprintf_timestamp()
time = localtime(&tm);
sprintf(pid, "[%d]", MyProcPid);
sprintf(timestamp, "%02d%02d%02d.%02d:%02d:%02d.%03d %7s ",
time->tm_year, time->tm_mon + 1, time->tm_mday,
sprintf(timestamp, "%04d%02d%02d.%02d:%02d:%02d.%03d %7s ",
time->tm_year+1900, time->tm_mon + 1, time->tm_mday,
time->tm_hour, time->tm_min, time->tm_sec,
(int) (tv.tv_usec/1000), pid);
......
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