mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 19:02:21 +01:00
it kinda work
This commit is contained in:
25
Project Reboot 3.0/GenericPlatformTime.h
Normal file
25
Project Reboot 3.0/GenericPlatformTime.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "inc.h"
|
||||
|
||||
struct FGenericPlatformTime
|
||||
{
|
||||
static FORCEINLINE uint32 Cycles()
|
||||
{
|
||||
struct timeval tv{};
|
||||
FILETIME ft;
|
||||
ULARGE_INTEGER uli{};
|
||||
|
||||
GetSystemTimeAsFileTime(&ft); // Get current time
|
||||
uli.LowPart = ft.dwLowDateTime;
|
||||
uli.HighPart = ft.dwHighDateTime;
|
||||
|
||||
// Convert to microseconds
|
||||
uli.QuadPart /= 10;
|
||||
uli.QuadPart -= 11644473600000000ULL;
|
||||
|
||||
tv.tv_sec = (long)(uli.QuadPart / 1000000);
|
||||
tv.tv_usec = (long)(uli.QuadPart % 1000000);
|
||||
return (uint32)((((uint64)tv.tv_sec) * 1000000ULL) + (((uint64)tv.tv_usec)));
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user