7
7
*
8
8
*
9
9
* IDENTIFICATION
10
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.78 2000/01/02 01:37:27 momjian Exp $
10
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.79 2000/01/02 02:32:37 momjian Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -322,7 +322,8 @@ GetEpochTime(struct tm * tm)
322
322
tm -> tm_min = t0 -> tm_min ;
323
323
tm -> tm_sec = t0 -> tm_sec ;
324
324
325
- tm -> tm_year += 1900 ;
325
+ if (tm -> tm_year < 1900 )
326
+ tm -> tm_year += 1900 ;
326
327
tm -> tm_mon ++ ;
327
328
328
329
return ;
@@ -2310,7 +2311,6 @@ datetime2tm(DateTime dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
2310
2311
2311
2312
#ifdef USE_POSIX_TIME
2312
2313
tx = localtime (& utime );
2313
- #endif
2314
2314
tm -> tm_year = tx -> tm_year + 1900 ;
2315
2315
tm -> tm_mon = tx -> tm_mon + 1 ;
2316
2316
tm -> tm_mday = tx -> tm_mday ;
@@ -3288,15 +3288,13 @@ DecodeNumber(int flen, char *str, int fmask,
3288
3288
}
3289
3289
3290
3290
tm -> tm_year = val ;
3291
-
3292
3291
}
3293
3292
/* already have year? then could be month */
3294
3293
else if ((fmask & DTK_M (YEAR )) && (!(fmask & DTK_M (MONTH )))
3295
3294
&& ((val >= 1 ) && (val <= 12 )))
3296
3295
{
3297
3296
* tmask = DTK_M (MONTH );
3298
3297
tm -> tm_mon = val ;
3299
-
3300
3298
/* no year and EuroDates enabled? then could be day */
3301
3299
}
3302
3300
else if ((EuroDates || (fmask & DTK_M (MONTH )))
@@ -3305,14 +3303,12 @@ DecodeNumber(int flen, char *str, int fmask,
3305
3303
{
3306
3304
* tmask = DTK_M (DAY );
3307
3305
tm -> tm_mday = val ;
3308
-
3309
3306
}
3310
3307
else if ((!(fmask & DTK_M (MONTH )))
3311
3308
&& ((val >= 1 ) && (val <= 12 )))
3312
3309
{
3313
3310
* tmask = DTK_M (MONTH );
3314
3311
tm -> tm_mon = val ;
3315
-
3316
3312
}
3317
3313
else if ((!(fmask & DTK_M (DAY )))
3318
3314
&& ((val >= 1 ) && (val <= 31 )))
@@ -3354,7 +3350,6 @@ DecodeNumberField(int len, char *str, int fmask,
3354
3350
tm -> tm_mon = atoi (str + 4 );
3355
3351
* (str + 4 ) = '\0' ;
3356
3352
tm -> tm_year = atoi (str + 0 );
3357
-
3358
3353
/* yymmdd or hhmmss? */
3359
3354
}
3360
3355
else if (len == 6 )
0 commit comments