mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-25 22:08:30 +00:00
Clean up some sleep code
This commit is contained in:
parent
9849b4c7ba
commit
672ccda37c
35 changed files with 310 additions and 598 deletions
14
third_party/nsync/testing/time_extra.c
vendored
14
third_party/nsync/testing/time_extra.c
vendored
|
@ -41,20 +41,6 @@ char *nsync_time_str (nsync_time t, int decimals) {
|
|||
return (smprintf ("%.*f%s", decimals, s/scale[i].multiplier, scale[i].suffix));
|
||||
}
|
||||
|
||||
int nsync_time_sleep_until (nsync_time abs_deadline) {
|
||||
int result = 0;
|
||||
nsync_time now;
|
||||
now = nsync_time_now ();
|
||||
if (nsync_time_cmp (abs_deadline, now) > 0) {
|
||||
nsync_time remaining;
|
||||
remaining = nsync_time_sleep (nsync_time_sub (abs_deadline, now));
|
||||
if (nsync_time_cmp (remaining, nsync_time_zero) > 0) {
|
||||
result = EINTR;
|
||||
}
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
double nsync_time_to_dbl (nsync_time t) {
|
||||
return (((double) NSYNC_TIME_SEC (t)) + ((double) NSYNC_TIME_NSEC (t) * 1e-9));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue