[vlc-devel] [PATCH 3/6] os2: thread: use gettimeofday() instead of time()

KO Myung-Hun komh78 at gmail.com
Wed Jun 10 05:27:26 CEST 2015


---
 src/os2/thread.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/os2/thread.c b/src/os2/thread.c
index 1f3885c..8673405 100644
--- a/src/os2/thread.c
+++ b/src/os2/thread.c
@@ -343,9 +343,15 @@ int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
         mtime_t total;
         switch (p_condvar->clock)
         {
-            case CLOCK_REALTIME: /* FIXME? sub-second precision */
-                total = CLOCK_FREQ * time (NULL);
+            case CLOCK_REALTIME:
+            {
+                struct timeval tv;
+                gettimeofday (&tv, NULL);
+
+                total = CLOCK_FREQ * tv.tv_sec +
+                        CLOCK_FREQ * tv.tv_usec / 1000000L;
                 break;
+            }
             default:
                 assert (p_condvar->clock == CLOCK_MONOTONIC);
                 total = mdate();
-- 
1.9.5




More information about the vlc-devel mailing list