mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-12 14:09:12 +00:00
Cherry-pick bug fixes and Landlock Make 1.0.2
This commit is contained in:
parent
c1d99676c4
commit
7e1c78b4f3
13 changed files with 468 additions and 64 deletions
|
@ -23,9 +23,10 @@
|
|||
* Converts timespec interval to milliseconds.
|
||||
*/
|
||||
int64_t _timespec_tomillis(struct timespec x) {
|
||||
int64_t us;
|
||||
if (!__builtin_add_overflow(x.tv_sec, x.tv_nsec / 1000000, &us)) {
|
||||
return us;
|
||||
int64_t ms;
|
||||
if (!__builtin_mul_overflow(x.tv_sec, 1000ul, &ms) &&
|
||||
!__builtin_add_overflow(ms, x.tv_nsec / 1000000, &ms)) {
|
||||
return ms;
|
||||
} else {
|
||||
return INT64_MAX;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue