From: Zhao Zhili <[email protected]>
---
v3: add ff_read_time() rather than use av_gettime_relative() to get
nanosecond precision.
libavutil/timer.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libavutil/timer.h b/libavutil/timer.h
index 2cd299eca3..3e5d5ef23f 100644
--- a/libavutil/timer.h
+++ b/libavutil/timer.h
@@ -46,6 +46,8 @@
#include "macos_kperf.h"
#elif HAVE_MACH_ABSOLUTE_TIME
#include <mach/mach_time.h>
+#elif HAVE_CLOCK_GETTIME
+#include <time.h>
#endif
#include "common.h"
@@ -70,6 +72,14 @@
# define AV_READ_TIME gethrtime
# elif HAVE_MACH_ABSOLUTE_TIME
# define AV_READ_TIME mach_absolute_time
+# elif HAVE_CLOCK_GETTIME && defined(CLOCK_MONOTONIC)
+ static inline int64_t ff_read_time(void)
+ {
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ return (int64_t) ts.tv_sec * 1000000000 + ts.tv_nsec;
+ }
+# define AV_READ_TIME ff_read_time
# endif
#endif
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".