diff --git a/src/LScreens.c b/src/LScreens.c index e778a90ce..1e44aaa23 100644 --- a/src/LScreens.c +++ b/src/LScreens.c @@ -1419,7 +1419,7 @@ static void UpdatesScreen_Get(cc_bool release, cc_bool d3d9) { String str; char strBuffer[STRING_SIZE]; struct UpdatesScreen* s = &UpdatesScreen_Instance; - TimeMS time = release ? CheckUpdateTask.relTimestamp : CheckUpdateTask.devTimestamp; + cc_uint64 time = release ? CheckUpdateTask.relTimestamp : CheckUpdateTask.devTimestamp; if (!time || FetchUpdateTask.Base.working) return; FetchUpdateTask_Run(release, d3d9); @@ -1489,7 +1489,7 @@ static void UpdatesScreen_DevD3D9(void* w, int x, int y) { UpdatesScreen_Get(f static void UpdatesScreen_DevOpenGL(void* w, int x, int y) { UpdatesScreen_Get(false, false); } static void UpdatesScreen_Update(struct UpdatesScreen* s) { - TimeMS buildTime; + cc_uint64 buildTime; cc_result res; /* Initially fill out with update check result from main menu */ diff --git a/src/LWeb.c b/src/LWeb.c index 091e61d6d..47147550e 100644 --- a/src/LWeb.c +++ b/src/LWeb.c @@ -201,18 +201,20 @@ static void LWebTask_Reset(struct LWebTask* task) { task->completed = false; task->working = true; task->success = false; - task->start = DateTime_CurrentUTC_MS(); + task->start = Stopwatch_Measure(); task->res = 0; task->status = 0; } void LWebTask_Tick(struct LWebTask* task) { struct HttpRequest req; + cc_uint64 finish; int delta; if (task->completed) return; if (!Http_GetResult(&task->identifier, &req)) return; - delta = (int)(DateTime_CurrentUTC_MS() - task->start); + finish = Stopwatch_Measure(); + delta = (int)Stopwatch_ElapsedMilliseconds(task->start, finish); Platform_Log2("%s took %i", &task->identifier, &delta); task->res = req.result; diff --git a/src/LWeb.h b/src/LWeb.h index e6e07760b..04e7251f5 100644 --- a/src/LWeb.h +++ b/src/LWeb.h @@ -49,7 +49,7 @@ struct LWebTask { String identifier; /* Unique identifier for this web task. */ String url; /* URL this task is downloading from/uploading to. */ - TimeMS start; /* Point in time this task was started at. */ + cc_uint64 start; /* Timestamp of when this task was started at. */ /* Called when task successfully downloaded/uploaded data. */ void (*Handle)(cc_uint8* data, cc_uint32 len); }; diff --git a/src/Launcher.c b/src/Launcher.c index 91d1a9184..c4baa7b8e 100644 --- a/src/Launcher.c +++ b/src/Launcher.c @@ -110,7 +110,7 @@ static void Launcher_OnResize(void* obj) { static cc_bool Launcher_IsShutdown(int key) { if (key == KEY_F4 && Key_IsAltPressed()) return true; - /* On OSX, Cmd+Q should also terminate the process */ + /* On macOS, Cmd+Q should also terminate the process */ #ifdef CC_BUILD_OSX return key == 'Q' && Key_IsWinPressed(); #else diff --git a/src/Protocol.c b/src/Protocol.c index c3f941c98..caa44fbd1 100644 --- a/src/Protocol.c +++ b/src/Protocol.c @@ -36,7 +36,7 @@ static cc_bool classic_receivedFirstPos; /* Map state */ static cc_bool map_begunLoading; -static TimeMS map_receiveStart; +static cc_uint64 map_receiveBeg; static struct Stream map_part; static struct GZipHeader map_gzHeader; static int map_sizeIndex, map_volume; @@ -446,7 +446,7 @@ static void Classic_StartLoading(void) { GZipHeader_Init(&map_gzHeader); map_begunLoading = true; map_sizeIndex = 0; - map_receiveStart = DateTime_CurrentUTC_MS(); + map_receiveBeg = Stopwatch_Measure(); map_volume = 0; MapState_Init(&map); @@ -526,13 +526,15 @@ static void Classic_LevelDataChunk(cc_uint8* data) { static void Classic_LevelFinalise(cc_uint8* data) { int width, height, length; - int loadingMs; + cc_uint64 end; + int delta; Gui_Remove(LoadingScreen_UNSAFE_RawPointer); Camera_CheckFocus(); - loadingMs = (int)(DateTime_CurrentUTC_MS() - map_receiveStart); - Platform_Log1("map loading took: %i", &loadingMs); + end = Stopwatch_Measure(); + delta = Stopwatch_ElapsedMilliseconds(map_receiveBeg, end); + Platform_Log1("map loading took: %i", &delta); map_begunLoading = false; WoM_CheckSendWomID(); diff --git a/src/Utils.h b/src/Utils.h index b812512cf..8ad158625 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -8,7 +8,7 @@ /* Represents a particular instance in time in some timezone. Not necessarily UTC time. */ /* NOTE: TimeMS and DateTime_CurrentUTC_MS() should almost always be used instead. */ -/* This should only be used when actually needed. (e.g. log mesage time) */ +/* This struct should only be used when actually needed. (e.g. log message time) */ struct DateTime { int year; /* Year, ranges from 0 to 65535 */ int month; /* Month, ranges from 1 to 12 */