*** dt.c.orig Sat Jan 23 03:12:23 1999 --- dt.c Tue Feb 9 14:12:28 1999 *************** *** 2814,2819 **** --- 2814,2820 ---- int flen, val; int mer = HR24; + int haveTextMonth = FALSE; int is2digits = FALSE; int bc = FALSE; *************** *** 2955,2968 **** #ifdef DATEDEBUG printf("DecodeDateTime- month field %s value is %d\n", field[i], val); #endif tm->tm_mon = val; break; - /* - * daylight savings time modifier (solves "MET - * DST" syntax) - */ case DTZMOD: tmask |= DTK_M(DTZ); tm->tm_isdst = 1; if (tzp == NULL) --- 2956,2978 ---- #ifdef DATEDEBUG printf("DecodeDateTime- month field %s value is %d\n", field[i], val); #endif + /* already have a (numeric) month? then see if we can substitute... */ + if ((fmask & DTK_M(MONTH)) && (! haveTextMonth) + && (!(fmask & DTK_M(DAY))) + && ((tm->tm_mon >= 1) && (tm->tm_mon <= 31))) + { + tm->tm_mday = tm->tm_mon; + tmask = DTK_M(DAY); + #ifdef DATEDEBUG + printf("DecodeNumber- misidentified month previously; assign as day %d\n", tm->tm_mday); + #endif + } + haveTextMonth = TRUE; tm->tm_mon = val; break; case DTZMOD: + /* daylight savings time modifier (solves "MET DST" syntax) */ tmask |= DTK_M(DTZ); tm->tm_isdst = 1; if (tzp == NULL) *************** *** 3466,3482 **** *tmask = DTK_M(YEAR); /* already have a year? then see if we can substitute... */ ! if (fmask & DTK_M(YEAR)) { ! if ((!(fmask & DTK_M(DAY))) ! && ((tm->tm_year >= 1) && (tm->tm_year <= 31))) ! { #ifdef DATEDEBUG ! printf("DecodeNumber- misidentified year previously; swap with day %d\n", tm->tm_mday); #endif - tm->tm_mday = tm->tm_year; - *tmask = DTK_M(DAY); - } } tm->tm_year = val; --- 3476,3489 ---- *tmask = DTK_M(YEAR); /* already have a year? then see if we can substitute... */ ! if ((fmask & DTK_M(YEAR)) && (!(fmask & DTK_M(DAY))) ! && ((tm->tm_year >= 1) && (tm->tm_year <= 31))) { ! tm->tm_mday = tm->tm_year; ! *tmask = DTK_M(DAY); #ifdef DATEDEBUG ! printf("DecodeNumber- misidentified year previously; assign as day %d\n", tm->tm_mday); #endif } tm->tm_year = val;