X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fplatform%2Ftimeutils.h;h=b2f613add0d85657015a72ab667f46360c9699a4;hb=102120cb9d6b3c723ed44b22ae1c97cb160e0bcc;hp=d793005b80fbcd210df373d58d874fcc09af5b74;hpb=f7febb0e8d28a15658f3b53477cc5051e50be9a1;p=deb_libcec.git diff --git a/src/lib/platform/timeutils.h b/src/lib/platform/timeutils.h index d793005..b2f613a 100644 --- a/src/lib/platform/timeutils.h +++ b/src/lib/platform/timeutils.h @@ -41,8 +41,41 @@ #include #endif -namespace CEC +#include "os.h" + +namespace PLATFORM { + #if defined(__WINDOWS__) + struct timezone + { + int tz_minuteswest; + int tz_dsttime; + }; + + #define usleep(t) Sleep((DWORD)(t)/1000) + + inline int gettimeofday(struct timeval *pcur_time, struct timezone *tz) + { + if (pcur_time == NULL) + { + SetLastError(EFAULT); + return -1; + } + struct _timeb current; + + _ftime(¤t); + + pcur_time->tv_sec = (long) current.time; + pcur_time->tv_usec = current.millitm * 1000L; + if (tz) + { + tz->tz_minuteswest = current.timezone; /* minutes west of Greenwich */ + tz->tz_dsttime = current.dstflag; /* type of dst correction */ + } + return 0; + } + #endif + inline int64_t GetTimeMs() { #if defined(__APPLE__)