X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fformat-guesser.c;h=189320d293d16ba8787a06b4b5896137e8ebacb5;hb=cd388a78240706bfe62d3b99d3362942ce8fd925;hp=17c5da90ceb8b2f74012889a3bcd036a798ef799;hpb=81579d9e9f994fb2908f50af41c3eb033d216e58;p=pspp diff --git a/src/data/format-guesser.c b/src/data/format-guesser.c index 17c5da90ce..189320d293 100644 --- a/src/data/format-guesser.c +++ b/src/data/format-guesser.c @@ -120,6 +120,15 @@ static struct date_syntax syntax[] = 11, {DT_DAY, DT_DELIM, DT_MONTH, DT_DELIM, DT_YEAR, DT_SPACE, DT_HOUR, DT_COLON, DT_MINUTE, DT_COLON, DT_SECOND} }, + /* yyyy-dd-mmm HH:MM */ + { FMT_YMDHMS, + 9, {DT_YEAR, DT_DELIM, DT_MONTH, DT_DELIM, DT_DAY, DT_SPACE, DT_HOUR, + DT_COLON, DT_MINUTE} }, + /* yyyy-dd-mmm HH:MM:SS */ + { FMT_YMDHMS, + 11, {DT_YEAR, DT_DELIM, DT_MONTH, DT_DELIM, DT_DAY, DT_SPACE, DT_HOUR, + DT_COLON, DT_MINUTE, DT_COLON, DT_SECOND} }, + /* HH:MM */ { FMT_TIME, 3, {DT_HOUR, DT_COLON, DT_MINUTE} }, /* HH:MM:SS */ @@ -325,7 +334,7 @@ add_numeric (struct fmt_guesser *g, struct substring s) if (dots || commas) delim_digits++; } - else if (c == '.' ) + else if (c == '.') { dots++; prev_delim = c; @@ -457,11 +466,15 @@ guess_numeric (struct fmt_guesser *g, struct fmt_spec *f) } /* Tries to parse S as a date (DATE, ADATE, EDATE, SDATE, QYR, - MOYR, WKYR, or DATETIME), time (TIME or DTIME), or date - component (WKDAY or MONTH) format. If successful, increments - G's any_date counter and the counter or counters for the - specific format(s) that S matches. On failure, does not - modify G. + MOYR, WKYR, DATETIME, or YMDHMS), time (TIME or DTIME), or + date component (WKDAY or MONTH) format. If successful, + increments G's any_date counter and the counter or counters + for the specific format(s) that S matches. On failure, does + not modify G. + + XXX How can we distinguish MTIME from TIME? One way might be + that TIME can have three parts (HH:MM:SS) but MTIME only ever + has two (MM:SS). Does not attempt to recognize JDATE format: it looks just like F format and will thus be caught by the numeric parser. @@ -571,8 +584,8 @@ guess_date_time (struct fmt_guesser *g, struct fmt_spec *f) (We use the minimum input width, but an output width would be equally appropriate, since all the time formats have the same minimum widths for input and output.) */ - if (f->type == FMT_DATETIME || f->type == FMT_TIME - || f->type == FMT_DTIME) + if (f->type == FMT_DATETIME || f->type == FMT_YMDHMS + || f->type == FMT_MTIME || f->type == FMT_TIME || f->type == FMT_DTIME) { for (i = 0; i < DATE_SYNTAX_CNT; i++) if (g->date[i]