date handling: handle "AM"/"PM" on time

And be a bitmore careful about matching: if we don't recognize a word
or a number, we skip the whole thing, rather than trying the next character
in that word/number.

Finally: since ctime() adds the final '\n', don't add another one in test-date.
This commit is contained in:
Linus Torvalds
2005-05-01 12:34:56 -07:00
parent 198b0fb635
commit 68849b5442
2 changed files with 23 additions and 9 deletions

View File

@ -14,7 +14,7 @@ int main(int argc, char **argv)
memcpy(result, "bad", 4);
parse_date(argv[i], result, sizeof(result));
t = strtoul(result, NULL, 0);
printf("%s -> %s -> %s\n", argv[i], result, ctime(&t));
printf("%s -> %s -> %s", argv[i], result, ctime(&t));
}
return 0;
}