Fix miliseconds in date on Emscripten and skip SDL create process (unsupported)

This commit is contained in:
Wojtek Figat
2026-02-17 15:07:42 +01:00
parent 9772227146
commit 69cefb6822
3 changed files with 5 additions and 4 deletions

View File

@@ -27,6 +27,7 @@
namespace
{
CPUInfo Cpu;
double DateStart = emscripten_get_now();
};
void WebFileSystem::GetSpecialFolderPath(const SpecialFolder type, String& result)
@@ -117,7 +118,7 @@ void WebPlatform::GetSystemTime(int32& year, int32& month, int32& dayOfWeek, int
hour = time.tm_hour;
minute = time.tm_min;
second = time.tm_sec;
millisecond = abs((int64)emscripten_get_now()) % 1000; // Fake it based on other timer
millisecond = (int64)(emscripten_get_now() - DateStart) % 1000; // Fake it based on other timer
}
void WebPlatform::GetUTCTime(int32& year, int32& month, int32& dayOfWeek, int32& day, int32& hour, int32& minute, int32& second, int32& millisecond)
@@ -136,7 +137,7 @@ void WebPlatform::GetUTCTime(int32& year, int32& month, int32& dayOfWeek, int32&
hour = time.tm_hour;
minute = time.tm_min;
second = time.tm_sec;
millisecond = abs((int64)emscripten_get_now()) % 1000; // Fake it based on other timer
millisecond = (int64)(emscripten_get_now() - DateStart) % 1000; // Fake it based on other timer
}
#if !BUILD_RELEASE