mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 03:08:31 +00:00
parent
95f54eeb40
commit
c1d99676c4
1421 changed files with 5556 additions and 2198 deletions
|
@ -23,10 +23,9 @@
|
|||
* Converts timespec interval to milliseconds.
|
||||
*/
|
||||
int64_t _timespec_tomillis(struct timespec x) {
|
||||
int64_t ns;
|
||||
if (!__builtin_mul_overflow(x.tv_sec, 1000ul, &ns) &&
|
||||
!__builtin_add_overflow(ns, x.tv_nsec / 1000000, &ns)) {
|
||||
return ns;
|
||||
int64_t us;
|
||||
if (!__builtin_add_overflow(x.tv_sec, x.tv_nsec / 1000000, &us)) {
|
||||
return us;
|
||||
} else {
|
||||
return INT64_MAX;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue