]> granicus.if.org Git - postgresql/commitdiff
Fix return value for tm2datetime to properly indicate failure.
authorThomas G. Lockhart <lockhart@fourpalms.org>
Tue, 13 May 1997 04:26:07 +0000 (04:26 +0000)
committerThomas G. Lockhart <lockhart@fourpalms.org>
Tue, 13 May 1997 04:26:07 +0000 (04:26 +0000)
src/backend/utils/adt/dt.c

index de0ec56854422f49ccd21a5e40db70b287a7a2c6..ac9899fdba942e2e15f5e89774bc16e4bcd07155 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.20 1997/05/11 15:11:34 thomas Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.21 1997/05/13 04:26:07 thomas Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -700,7 +700,9 @@ printf( "datetime_add_span- date was %d.%02d.%02d\n", tm->tm_year, tm->tm_mon, t
 #ifdef DATEDEBUG
 printf( "datetime_add_span- date becomes %d.%02d.%02d\n", tm->tm_year, tm->tm_mon, tm->tm_mday);
 #endif
-               tm2datetime( tm, fsec, NULL, result);
+               if (tm2datetime( tm, fsec, NULL, result) != 0)
+                   elog(WARN,"Unable to add datetime and timespan",NULL);
+
 
            } else {
                DATETIME_INVALID(*result);
@@ -1673,7 +1675,7 @@ tm2datetime( struct tm *tm, double fsec, int *tzp, DateTime *result) {
 
     /* Julian day routines are not correct for negative Julian days */
     if (! IS_VALID_JULIAN( tm->tm_year, tm->tm_mon, tm->tm_mday))
-       return(DT_INVALID);
+       return(-1);
 
     date = date2j(tm->tm_year,tm->tm_mon,tm->tm_mday) - date2j(2000,1,1);
     time = time2t(tm->tm_hour,tm->tm_min,(tm->tm_sec + fsec));