On Sun, 26 Aug 2018 19:42:28 -0700
Yousuk Seung <ysse...@google.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?

Reply via email to