vlc | branch: master | Steve Lhomme <[email protected]> | Tue May 15 14:35:52 2018 +0200| [f0a7bc050fd5ff9f06502333703ce19bff2997a5] | committer: Steve Lhomme
compat: provide a win32 specific version of timespec_get On mingw64 clock_gettime() is defined in winpthread which we don't want to use. This implementation is based on the winpthread internal processing. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f0a7bc050fd5ff9f06502333703ce19bff2997a5 --- compat/timespec_get.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/compat/timespec_get.c b/compat/timespec_get.c index 350e912fd0..fb9adca7a1 100644 --- a/compat/timespec_get.c +++ b/compat/timespec_get.c @@ -22,6 +22,28 @@ # include <config.h> #endif +#ifdef _WIN32 +#include <windows.h> + +int timespec_get(struct timespec *ts, int base) +{ + FILETIME ft; + ULARGE_INTEGER s; + ULONGLONG t; + + if (base != TIME_UTC) + return 0; + + GetSystemTimeAsFileTime(&ft); + s.LowPart = ft.dwLowDateTime; + s.HighPart = ft.dwHighDateTime; + t = s.QuadPart - 116444736000000000ULL; + ts->tv_sec = t / 10000000; + ts->tv_nsec = ((int) (t % 10000000)) * 100; + return base; +} +#else /* !_WIN32 */ + #include <time.h> #include <unistd.h> /* _POSIX_TIMERS */ #ifndef _POSIX_TIMERS @@ -58,3 +80,4 @@ int timespec_get(struct timespec *ts, int base) } return base; } +#endif /* !_WIN32 */ _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
