8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.44 2000/03/16 14:36:51 thomas Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.45 2000/03/29 03:57:18 thomas Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -1367,8 +1367,11 @@ DecodeNumber(int flen, char *str, int fmask,
1367
1367
* more, but we now test first for a three-digit doy so anything
1368
1368
* bigger than two digits had better be an explicit year. - thomas
1369
1369
* 1999-01-09
1370
+ * Back to requiring a 4 digit year.
1371
+ * We accept a two digit year farther down.
1372
+ * - thomas 2000-03-28
1370
1373
*/
1371
- else if (flen > 2 )
1374
+ else if (flen >= 4 )
1372
1375
{
1373
1376
* tmask = DTK_M (YEAR );
1374
1377
@@ -1382,14 +1385,16 @@ DecodeNumber(int flen, char *str, int fmask,
1382
1385
1383
1386
tm -> tm_year = val ;
1384
1387
}
1388
+
1385
1389
/* already have year? then could be month */
1386
1390
else if ((fmask & DTK_M (YEAR )) && (!(fmask & DTK_M (MONTH )))
1387
1391
&& ((val >= 1 ) && (val <= 12 )))
1388
1392
{
1389
1393
* tmask = DTK_M (MONTH );
1390
1394
tm -> tm_mon = val ;
1391
- /* no year and EuroDates enabled? then could be day */
1395
+
1392
1396
}
1397
+ /* no year and EuroDates enabled? then could be day */
1393
1398
else if ((EuroDates || (fmask & DTK_M (MONTH )))
1394
1399
&& (!(fmask & DTK_M (YEAR )) && !(fmask & DTK_M (DAY )))
1395
1400
&& ((val >= 1 ) && (val <= 31 )))
@@ -1409,7 +1414,11 @@ DecodeNumber(int flen, char *str, int fmask,
1409
1414
* tmask = DTK_M (DAY );
1410
1415
tm -> tm_mday = val ;
1411
1416
}
1412
- else if (!(fmask & DTK_M (YEAR )))
1417
+ /* Check for 2 or 4 or more digits, but currently we reach here
1418
+ * only if two digits. - thomas 2000-03-28
1419
+ */
1420
+ else if (!(fmask & DTK_M (YEAR ))
1421
+ && ((flen >= 4 ) || (flen == 2 )))
1413
1422
{
1414
1423
* tmask = DTK_M (YEAR );
1415
1424
tm -> tm_year = val ;
0 commit comments