[vlc-commits] os2: thread: use gettimeofday() instead of time()

KO Myung-Hun git at videolan.org
Wed Jun 10 21:22:09 CEST 2015


vlc | branch: master | KO Myung-Hun <komh78 at gmail.com> | Wed Jun 10 12:27:26 2015 +0900| [f5e9d0f6327aefabffe168413d7485c03bf05339] | committer: Rémi Denis-Courmont

os2: thread: use gettimeofday() instead of time()

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f5e9d0f6327aefabffe168413d7485c03bf05339
---

 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();



More information about the vlc-commits mailing list