mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-24 07:06:36 +00:00
FS refactoring, 64-bit timestamps
This commit is contained in:
@@ -13,10 +13,29 @@ GpSystemServices_Win32::GpSystemServices_Win32()
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t GpSystemServices_Win32::GetTime() const
|
||||
int64_t GpSystemServices_Win32::GetTime() const
|
||||
{
|
||||
//PL_NotYetImplemented_TODO("Time");
|
||||
return 0;
|
||||
SYSTEMTIME epochStart;
|
||||
epochStart.wYear = 1904;
|
||||
epochStart.wMonth = 1;
|
||||
epochStart.wDayOfWeek = 5;
|
||||
epochStart.wDay = 1;
|
||||
epochStart.wHour = 0;
|
||||
epochStart.wMinute = 0;
|
||||
epochStart.wSecond = 0;
|
||||
epochStart.wMilliseconds = 0;
|
||||
|
||||
FILETIME epochStartFT;
|
||||
if (!SystemTimeToFileTime(&epochStart, &epochStartFT))
|
||||
return 0;
|
||||
|
||||
FILETIME currentTime;
|
||||
GetSystemTimeAsFileTime(¤tTime);
|
||||
|
||||
int64_t epochStart64 = (static_cast<int64_t>(epochStartFT.dwLowDateTime) & 0xffffffff) | (static_cast<int64_t>(epochStartFT.dwHighDateTime) << 32);
|
||||
int64_t currentTime64 = (static_cast<int64_t>(currentTime.dwLowDateTime) & 0xffffffff) | (static_cast<int64_t>(currentTime.dwHighDateTime) << 32);
|
||||
|
||||
return currentTime64 - epochStart64;
|
||||
}
|
||||
|
||||
void GpSystemServices_Win32::GetLocalDateTime(unsigned int &year, unsigned int &month, unsigned int &day, unsigned int &hour, unsigned int &minute, unsigned int &second) const
|
||||
@@ -36,12 +55,21 @@ PortabilityLayer::HostMutex *GpSystemServices_Win32::CreateMutex()
|
||||
{
|
||||
return GpMutex_Win32::Create();
|
||||
}
|
||||
|
||||
|
||||
PortabilityLayer::HostThreadEvent *GpSystemServices_Win32::CreateThreadEvent(bool autoReset, bool startSignaled)
|
||||
{
|
||||
return GpThreadEvent_Win32::Create(autoReset, startSignaled);
|
||||
}
|
||||
|
||||
uint64_t GpSystemServices_Win32::GetFreeMemoryCosmetic() const
|
||||
{
|
||||
MEMORYSTATUSEX memStatus;
|
||||
if (!GlobalMemoryStatusEx(&memStatus))
|
||||
return 0;
|
||||
|
||||
return memStatus.ullAvailPhys;
|
||||
}
|
||||
|
||||
GpSystemServices_Win32 *GpSystemServices_Win32::GetInstance()
|
||||
{
|
||||
return &ms_instance;
|
||||
|
Reference in New Issue
Block a user