summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README2
-rw-r--r--src/datetime.c11
2 files changed, 11 insertions, 2 deletions
diff --git a/README b/README
index 6fb4f30..74ccb04 100644
--- a/README
+++ b/README
@@ -18,7 +18,7 @@ user interaction.
Date/Time Formats
-----------------
-@ currently supports 704 date/time formats, any one of which may be
+@ currently supports 705 date/time formats, any one of which may be
specified on the command line in one or more arguments. All spaces
shown below are optional.
diff --git a/src/datetime.c b/src/datetime.c
index 27c27a2..230a348 100644
--- a/src/datetime.c
+++ b/src/datetime.c
@@ -32,7 +32,6 @@
/* IMPORTANT: All of the format strings in each array must be padded with spaces
* to be of equal lengths */
static const char *DATETIME_DATE_FMTS_[] = {
- " ", /* */
" %a ", /* Wed */
" %Y-%m-%d ", /* 1969-12-31 */
" %Y/%m/%d ", /* 1969/12/31 */
@@ -191,6 +190,16 @@ datetime_parse(struct tm *now_tm, const char *input, time_t *arg_sec)
return -1;
}
+ for (t = 0; t < sizeof(DATETIME_TIME_FMTS_) /
+ sizeof(DATETIME_TIME_FMTS_[0]) ; ++t) {
+ _datetime_reset_tm(&arg_tm);
+ end = strptime(input, DATETIME_TIME_FMTS_[t], &arg_tm);
+ if (end != NULL && *end == '\0') {
+ free(fmt_buf);
+ _datetime_normalize(&arg_tm, arg_sec);
+ return 0;
+ }
+ }
for (d = 0; d < sizeof(DATETIME_DATE_FMTS_) /
sizeof(DATETIME_DATE_FMTS_[0]); ++d) {
memcpy(fmt_buf, DATETIME_DATE_FMTS_[d], date_fmt_len);