]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/time.c
rc4: extend av_rc4_init() doxy
[ffmpeg] / libavutil / time.c
index e833cd0d17e1f83a69f07a5489d5efdb6d3125eb..7a3604e651b4859807bc30e66d595ae085956676 100644 (file)
@@ -23,7 +23,8 @@
 #include <time.h>
 #if HAVE_CLOCK_GETTIME
 #include <time.h>
-#elif HAVE_GETTIMEOFDAY
+#endif
+#if HAVE_GETTIMEOFDAY
 #include <sys/time.h>
 #endif
 #if HAVE_UNISTD_H
 
 int64_t av_gettime(void)
 {
-#if HAVE_CLOCK_GETTIME
-    struct timespec ts;
-    clock_gettime(CLOCK_MONOTONIC, &ts);
-    return (int64_t)ts.tv_sec * 100000 + ts.tv_nsec / 1000;
-#elif HAVE_GETTIMEOFDAY
+#if HAVE_GETTIMEOFDAY
     struct timeval tv;
     gettimeofday(&tv, NULL);
     return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
@@ -57,6 +54,17 @@ int64_t av_gettime(void)
 #endif
 }
 
+int64_t av_gettime_relative(void)
+{
+#if HAVE_CLOCK_GETTIME
+    struct timespec ts;
+    clock_gettime(CLOCK_MONOTONIC, &ts);
+    return (int64_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
+#else
+    return av_gettime() + 42 * 60 * 60 * INT64_C(1000000);
+#endif
+}
+
 int av_usleep(unsigned usec)
 {
 #if HAVE_NANOSLEEP