Ignore:
Timestamp:
2018-08-25T21:35:26Z (7 years ago)
Author:
GitHub <noreply@…>
Parents:
e2625b1a (diff), 3c45353 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jakub Jermář <jakub@…> (2018-08-25 21:35:26)
git-committer:
GitHub <noreply@…> (2018-08-25 21:35:26)
Message:

Merge 3c453534a2b093c8039d8e8059b923c71f3492a3 into e2625b1a1e5a2895b86f0e39c2d70a39e49e042a

File:
1 edited

Legend:

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

    re2625b1a r231b3fd  
    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.