[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180827091156.46691f4f@shemminger-XPS-13-9360>
Date: Mon, 27 Aug 2018 09:11:55 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Yousuk Seung <ysseung@...gle.com>
Cc: netdev@...r.kernel.org, David Ahern <dsahern@...il.com>,
Michael McLennan <nefario@...gle.com>,
Priyaranjan Jha <priyarjha@...gle.com>,
Dave Taht <dave.taht@...il.com>,
Neal Cardwell <ncardwell@...gle.com>
Subject: Re: [PATCH v2 iproute2-next 1/3] tc: support conversions to or from
64 bit nanosecond-based time
On Sun, 26 Aug 2018 19:42:28 -0700
Yousuk Seung <ysseung@...gle.com> wrote:
> +int get_time(unsigned int *time, const char *str)
> +{
> + double t;
> + char *p;
> +
> + t = strtod(str, &p);
> + if (p == str)
> + return -1;
> +
> + if (*p) {
> + if (strcasecmp(p, "s") == 0 || strcasecmp(p, "sec") == 0 ||
> + strcasecmp(p, "secs") == 0)
> + t *= TIME_UNITS_PER_SEC;
> + else if (strcasecmp(p, "ms") == 0 || strcasecmp(p, "msec") == 0 ||
> + strcasecmp(p, "msecs") == 0)
> + t *= TIME_UNITS_PER_SEC/1000;
> + else if (strcasecmp(p, "us") == 0 || strcasecmp(p, "usec") == 0 ||
> + strcasecmp(p, "usecs") == 0)
> + t *= TIME_UNITS_PER_SEC/1000000;
> + else
> + return -1;
Do we need to really support UPPER case.
Isn't existing matches semantics good enough?
Powered by blists - more mailing lists