mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +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;
|
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
|
// nanoseconds
|
||||||
lpFrequency->QuadPart = (1000000000);
|
lpFrequency->QuadPart = 1000000000;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount)
|
static inline BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // LINUXSTUBS_H
|
#endif // LINUXSTUBS_H
|
||||||
Loading…
Reference in a new issue