[vlc-commits] Win32: has gettimeofday()

Rémi Denis-Courmont git at videolan.org
Thu Oct 4 19:34:07 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct  4 20:33:38 2012 +0300| [3647bd9a1f86f3040ac8e6101cf311dcbcd96a75] | committer: Rémi Denis-Courmont

Win32: has gettimeofday()

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

 src/input/vlm.c |   28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/src/input/vlm.c b/src/input/vlm.c
index 15d2e24..0b980be 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -34,21 +34,14 @@
 
 #include <stdio.h>
 #include <ctype.h>                                              /* tolower() */
+#include <time.h>                                                 /* ctime() */
+#include <limits.h>
 #include <assert.h>
+#include <sys/time.h>                                      /* gettimeofday() */
 
 #include <vlc_vlm.h>
 #include <vlc_modules.h>
 
-#ifndef WIN32
-#   include <sys/time.h>                                   /* gettimeofday() */
-#endif
-
-#include <time.h>                                                 /* ctime() */
-#if defined (WIN32)
-#include <sys/timeb.h>                                            /* ftime() */
-#endif
-#include <limits.h>
-
 #include <vlc_input.h>
 #include <vlc_stream.h>
 #include "vlm_internal.h"
@@ -272,17 +265,10 @@ int vlm_ExecuteCommand( vlm_t *p_vlm, const char *psz_command,
 
 int64_t vlm_Date(void)
 {
-#if defined (WIN32)
-    struct timeb tm;
-    ftime( &tm );
-    return ((int64_t)tm.time) * 1000000 + ((int64_t)tm.millitm) * 1000;
-#else
-    struct timeval tv_date;
-
-    /* gettimeofday() cannot fail given &tv_date is a valid address */
-    (void)gettimeofday( &tv_date, NULL );
-    return (mtime_t) tv_date.tv_sec * 1000000 + (mtime_t) tv_date.tv_usec;
-#endif
+    struct timeval tv;
+
+    (void)gettimeofday( &tv, NULL );
+    return tv.tv_sec * INT64_C(1000000) + tv.tv_usec;
 }
 
 



More information about the vlc-commits mailing list