Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/sleep/sleep.c

    r5f97ef44 r205f1add  
    5757}
    5858
    59 /** Convert string containing decimal seconds to useconds_t.
     59/** Convert string containing decimal seconds to usec_t.
    6060 *
    6161 * @param nptr   Pointer to string.
     
    6363 * @return EOK if conversion was successful.
    6464 */
    65 static errno_t decimal_to_useconds(const char *nptr, useconds_t *result)
     65static errno_t decimal_to_useconds(const char *nptr, usec_t *result)
    6666{
    6767        errno_t ret;
    68         uint64_t whole_seconds;
    69         uint64_t frac_seconds;
     68        sec_t whole_seconds;
     69        usec_t frac_seconds;
    7070        const char *endptr;
    7171
     
    7575                endptr = (char *)nptr;
    7676        } else {
    77                 ret = str_uint64_t(nptr, &endptr, 10, false, &whole_seconds);
     77                ret = str_int64_t(nptr, &endptr, 10, false, &whole_seconds);
    7878                if (ret != EOK)
    7979                        return ret;
     
    8787        } else if (*endptr == '.') {
    8888                nptr = endptr + 1;
    89                 ret = str_uint64_t(nptr, &endptr, 10, true, &frac_seconds);
     89                ret = str_int64_t(nptr, &endptr, 10, true, &frac_seconds);
    9090                if (ret != EOK)
    9191                        return ret;
     
    101101
    102102        /* Check for overflow */
    103         useconds_t total = whole_seconds * 1000000 + frac_seconds;
    104         if (total / 1000000 != whole_seconds)
     103        usec_t total = SEC2USEC(whole_seconds) + frac_seconds;
     104        if (USEC2SEC(total) != whole_seconds)
    105105                return EOVERFLOW;
    106106
     
    115115        errno_t ret;
    116116        unsigned int argc;
    117         useconds_t duration = 0;
     117        usec_t duration = 0;
    118118
    119119        /* Count the arguments */
Note: See TracChangeset for help on using the changeset viewer.