[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH v2] libbb: fix time parsing of [[CC]YY]MMDDhhmm[.SS]
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2016-05-31 0:56:28
Message-ID: CAK1hOcM+XUn0-6ZzJRQ6UqXxONeMR5+D4kHtE9tCTdGjz9vPxw () mail ! gmail ! com
[Download RAW message or body]

Applied, thanks.

On Thu, May 19, 2016 at 5:31 PM, Natanael Copa <ncopa@alpinelinux.org> wrote:
> If SS is not given a value, it is assumed to be zero.
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html
>
> closes 8951
>
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
> ---
> V1 -> V2 changes:
>
>  - always set seconds to 0. If you for example do: `touch -t 1100 somefile`
>    you will expect to set timestamp to 11:00:00 AM not, 11:00:<current sec>
>
>  libbb/time.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libbb/time.c b/libbb/time.c
> index aa19a47..82e6cb1 100644
> --- a/libbb/time.c
> +++ b/libbb/time.c
> @@ -186,6 +186,7 @@ void FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm)
>                 } else {
>                         bb_error_msg_and_die(bb_msg_invalid_date, date_str);
>                 }
> +               ptm->tm_sec = 0; /* assume zero if [.SS] is not given */
>                 if (end == '.') {
>                         /* xxx.SS */
>                         if (sscanf(strchr(date_str, '.') + 1, "%u%c",
> --
> 2.8.2
>
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic