summaryrefslogtreecommitdiffstats
path: root/osdep/timer.h
diff options
context:
space:
mode:
Diffstat (limited to 'osdep/timer.h')
-rw-r--r--osdep/timer.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/osdep/timer.h b/osdep/timer.h
index 3a925ca..5fedbb6 100644
--- a/osdep/timer.h
+++ b/osdep/timer.h
@@ -19,13 +19,17 @@
#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);
-// Return time in nanoseconds. Never wraps. Never returns 0 or negative values.
+// 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,12 +42,17 @@ 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 ms if needed and started successfully, else 0
-int mp_start_hires_timers(int wait_ms);
+// returns: timer resolution in ns if needed and started successfully, else 0
+int64_t mp_start_hires_timers(int64_t wait_ns);
// call unconditionally with the return value of mp_start_hires_timers
-void mp_end_hires_timers(int resolution_ms);
+void mp_end_hires_timers(int64_t resolution_ns);
#endif /* _WIN32 */
// Converts time units to nanoseconds (int64_t)