[PATCH] [RFC] parse_date: support another date input format

Denys Vlasenko vda.linux at googlemail.com
Mon Mar 22 17:25:49 UTC 2010


On Mon, Mar 22, 2010 at 3:09 PM, Alexander Shishkin <virtuoso at slind.org> wrote:
> +               } else
> +               /* month_name d HH:MM:SS

YYYY

> +                * this is supported by the GNU make */

perhaps GNU *date*?

> +               if (isalpha(date_str[0])) {

Why do you want to check that? in some locales it may fail...

> +                       char *res = strptime(date_str, "%b %d %T %Y", ptm);
> +                       if (!res || *res)
> +                               bb_error_msg_and_die(bb_msg_invalid_date, date_str);
>  //TODO: coreutils 6.9 also accepts "yyyy-mm-dd HH" (no minutes)

...and here you fall through to code which tries to parse seconds,
which is wrong.

>                } else {
>                        bb_error_msg_and_die(bb_msg_invalid_date, date_str);



Applied with some changes. Thanks!
-- 
vda


More information about the busybox mailing list