summaryrefslogtreecommitdiffstats
path: root/osdep/timer.h
diff options
context:
space:
mode:
Diffstat (limited to 'osdep/timer.h')
-rw-r--r--osdep/timer.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/osdep/timer.h b/osdep/timer.h
index d8ec185bfe..5fedbb69cd 100644
--- a/osdep/timer.h
+++ b/osdep/timer.h
@@ -19,6 +19,7 @@
#define MPLAYER_TIMER_H
#include <inttypes.h>
+#include "config.h"
// Initialize timer, must be called at least once at start.
void mp_time_init(void);
@@ -26,6 +27,9 @@ void mp_time_init(void);
// Return time in nanoseconds. Never wraps. Never returns negative values.
int64_t mp_time_ns(void);
+// Return time in nanoseconds. Coverts raw time in nanoseconds to mp time, subtracts init offset.
+int64_t mp_time_ns_from_raw_time(uint64_t raw_time);
+
// Return time in seconds. Can have down to 1 nanosecond resolution, but will
// be much worse when casted to float.
double mp_time_sec(void);
@@ -38,6 +42,11 @@ uint64_t mp_raw_time_ns(void);
// Sleep in nanoseconds.
void mp_sleep_ns(int64_t ns);
+#if HAVE_DARWIN
+// Coverts mach time to raw time in nanoseconds and returns it.
+uint64_t mp_raw_time_ns_from_mach(uint64_t mach_time);
+#endif
+
#ifdef _WIN32
// returns: timer resolution in ns if needed and started successfully, else 0
int64_t mp_start_hires_timers(int64_t wait_ns);