On platform where no monotonic clock is available, the difference
between the two av_gettime functions is not clear, and one could
mistakenly use the relative clock where an absolute one is
required. Therefore add an offset, to make it evident that the
time returned from av_gettime_relative never is actual current
real time, even though it is based on av_gettime.
---
Should the doxy for the function be changed? Previously it says

    If a monotonic clock is not available on the targeted platform, the
    implementation falls back on using av_gettime().

Technically it still falls back on av_gettime(), but it obviously
won't return similar values.
---
 libavutil/time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/time.c b/libavutil/time.c
index 40f7cf1..4f0d061 100644
--- a/libavutil/time.c
+++ b/libavutil/time.c
@@ -61,7 +61,7 @@ int64_t av_gettime_relative(void)
     clock_gettime(CLOCK_MONOTONIC, &ts);
     return (int64_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
 #else
-    return av_gettime();
+    return av_gettime() + 42 * 60 * 60 * 1000000;
 #endif
 }
 
-- 
1.9.3 (Apple Git-50)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to