Changeset 205f1add in mainline for uspace/app/bdsh/cmds/modules/sleep/sleep.c
- Timestamp:
- 2018-08-23T21:14:56Z (6 years ago)
- Children:
- f33c989e
- Parents:
- e2625b1a
- git-author:
- Jakub Jermar <jakub@…> (2018-08-21 21:58:52)
- git-committer:
- Jakub Jermar <jakub@…> (2018-08-23 21:14:56)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/sleep/sleep.c
re2625b1a r205f1add 57 57 } 58 58 59 /** Convert string containing decimal seconds to usec onds_t.59 /** Convert string containing decimal seconds to usec_t. 60 60 * 61 61 * @param nptr Pointer to string. … … 63 63 * @return EOK if conversion was successful. 64 64 */ 65 static errno_t decimal_to_useconds(const char *nptr, usec onds_t *result)65 static errno_t decimal_to_useconds(const char *nptr, usec_t *result) 66 66 { 67 67 errno_t ret; 68 uint64_t whole_seconds;69 u int64_t frac_seconds;68 sec_t whole_seconds; 69 usec_t frac_seconds; 70 70 const char *endptr; 71 71 … … 75 75 endptr = (char *)nptr; 76 76 } else { 77 ret = str_ uint64_t(nptr, &endptr, 10, false, &whole_seconds);77 ret = str_int64_t(nptr, &endptr, 10, false, &whole_seconds); 78 78 if (ret != EOK) 79 79 return ret; … … 87 87 } else if (*endptr == '.') { 88 88 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); 90 90 if (ret != EOK) 91 91 return ret; … … 101 101 102 102 /* Check for overflow */ 103 usec onds_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) 105 105 return EOVERFLOW; 106 106 … … 115 115 errno_t ret; 116 116 unsigned int argc; 117 usec onds_t duration = 0;117 usec_t duration = 0; 118 118 119 119 /* Count the arguments */
Note:
See TracChangeset
for help on using the changeset viewer.