mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-11 01:07:15 +00:00
feat: implement GetTickCount
This commit is contained in:
parent
7c578c2161
commit
5d5e4b4418
|
|
@ -520,21 +520,34 @@ static inline BOOL FindClose(HANDLE hFindFile)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency)
|
||||
static inline DWORD GetTickCount()
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
|
||||
// milliseconds
|
||||
return (long long)ts.tv_sec * 1000 + (long long)ts.tv_nsec / 1000000;
|
||||
}
|
||||
|
||||
static inline BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency)
|
||||
{
|
||||
// nanoseconds
|
||||
lpFrequency->QuadPart = (1000000000);
|
||||
lpFrequency->QuadPart = 1000000000;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static inline BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount)
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
|
||||
lpPerformanceCount->QuadPart = (ts.tv_sec * 1000000000LL) + ts.tv_nsec;
|
||||
// nanoseconds
|
||||
lpPerformanceCount->QuadPart = ((long long)ts.tv_sec * 1000000000) + (long long)ts.tv_nsec;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // LINUXSTUBS_H
|
||||
Loading…
Reference in a new issue