X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fplatform%2Ftimeutils.h;h=b2f613add0d85657015a72ab667f46360c9699a4;hb=f00ff009cfc5dfefdf09ca241b9560e74575b3f5;hp=f05f7e7139b598b98c820c7bf8c6091e46461847;hpb=7ebbb1a62355c2819caa42e28b081eff027b336d;p=deb_libcec.git diff --git a/src/lib/platform/timeutils.h b/src/lib/platform/timeutils.h index f05f7e7..b2f613a 100644 --- a/src/lib/platform/timeutils.h +++ b/src/lib/platform/timeutils.h @@ -41,10 +41,41 @@ #include #endif -#include "os-dependent.h" +#include "os.h" -namespace CEC +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__)