summaryrefslogtreecommitdiff
path: root/libavutil/time.h
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2014-10-22 12:14:37 +0300
committerMartin Storsjö <martin@martin.st>2014-10-24 09:53:41 +0300
commit1bd0bdcdc236099d5c0d179696951f35f5310fa5 (patch)
tree491ea4c261e03afa7d471b6fc41abae621ec1420 /libavutil/time.h
parentaf7ca6ea124b82b337a6b96e10963e88eba57ebe (diff)
lavu: Add av_gettime_relative
Since av_gettime() is used in a number of places where actual real time clock is required, the monotonic clock introduced in ebef9f5a5 would have consequences that are hard to handle. Instead split it into a separate function that can be used in the cases where only relative time is desired. 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. Based on a patch by Olivier Langlois. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavutil/time.h')
-rw-r--r--libavutil/time.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavutil/time.h b/libavutil/time.h
index b01a97d770..463bcfcdcf 100644
--- a/libavutil/time.h
+++ b/libavutil/time.h
@@ -27,6 +27,15 @@
int64_t av_gettime(void);
/**
+ * Get the current time in microseconds since some unspecified starting point.
+ * On platforms that support it, the time comes from a monotonic clock
+ * This property makes this time source ideal for measuring relative time.
+ * The returned values may not be monotonic on platforms where a monotonic
+ * clock is not available.
+ */
+int64_t av_gettime_relative(void);
+
+/**
* Sleep for a period of time. Although the duration is expressed in
* microseconds, the actual delay may be rounded to the precision of the
* system timer.