diff options
author | NRK <nrk@disroot.org> | 2023-10-27 01:24:41 +0600 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-10-27 18:07:19 +0000 |
commit | 8bbcc87feea7abf256a6c7f511244d09f5520c17 (patch) | |
tree | 069ce26d65fa713aec56592f53a51bfd6e48d5d2 /osdep/timer.c | |
parent | 2f91e1441e46f80d12998520b7ebce44c28e1da6 (diff) | |
download | mpv-8bbcc87feea7abf256a6c7f511244d09f5520c17.tar.bz2 mpv-8bbcc87feea7abf256a6c7f511244d09f5520c17.tar.xz |
timer: remove MP_START_TIME
instead require mp_raw_time_ns() to not return 0, which all current
implementation already should follow.
Diffstat (limited to 'osdep/timer.c')
-rw-r--r-- | osdep/timer.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/osdep/timer.c b/osdep/timer.c index 0d5fade659..c2a2b176ee 100644 --- a/osdep/timer.c +++ b/osdep/timer.c @@ -36,10 +36,7 @@ static void do_timer_init(void) mp_raw_time_init(); mp_rand_seed(mp_raw_time_ns()); raw_time_offset = mp_raw_time_ns(); - // Arbitrary additional offset to avoid confusing relative/absolute times. - // Also,we rule that the timer never returns 0 (so default-initialized - // time values will be always in the past). - raw_time_offset -= MP_START_TIME; + assert(raw_time_offset > 0); } void mp_time_init(void) @@ -49,10 +46,7 @@ void mp_time_init(void) int64_t mp_time_ns(void) { - uint64_t r = mp_raw_time_ns() - raw_time_offset; - if (r < MP_START_TIME) - r = MP_START_TIME; - return r; + return mp_raw_time_ns() - raw_time_offset; } double mp_time_sec(void) |