diff options
author | Dudemanguy <random342@airmail.cc> | 2023-09-29 17:24:21 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-10-10 19:10:55 +0000 |
commit | 59dd7d94af7651baf7e60966c5f8e7d52959d958 (patch) | |
tree | c6eb2938d2a63ebb07e377794f28ca708d786abd /osdep/timer-darwin.c | |
parent | fcebee9080a113f3248d218e451345db3f965b47 (diff) | |
download | mpv-59dd7d94af7651baf7e60966c5f8e7d52959d958.tar.bz2 mpv-59dd7d94af7651baf7e60966c5f8e7d52959d958.tar.xz |
timer: change mp_sleep_us to mp_sleep_ns
Linux and macOS already use nanosecond resolution for their sleep
functions. It was just being converted from microseconds before. Since
we have mp_time_ns now, go ahead and bump the precision here. The timer
for windows uses some timeBeginPeriod thing which I'm not sure what it
does really but whatever just convert the units to ms like they were
doing before. There's really no reason to keep the mp_sleep_us helper
around. A multiplication by 1000 is trivial and underlying OS clocks
have nanosecond precision.
Diffstat (limited to 'osdep/timer-darwin.c')
-rw-r--r-- | osdep/timer-darwin.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/osdep/timer-darwin.c b/osdep/timer-darwin.c index a114d0d727..bb8a9b4324 100644 --- a/osdep/timer-darwin.c +++ b/osdep/timer-darwin.c @@ -28,10 +28,9 @@ static double timebase_ratio_ns; -void mp_sleep_us(int64_t us) +void mp_sleep_ns(int64_t ns) { - uint64_t deadline = us * 1e3 / timebase_ratio_ns + mach_absolute_time(); - + uint64_t deadline = ns / timebase_ratio_ns + mach_absolute_time(); mach_wait_until(deadline); } |