From 1050cad3728c4bfe787452d99d0619c63d0cfdd3 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Sun, 4 May 2025 18:23:51 +0100 Subject: [PATCH] Update platformMemory.cpp add date and time to output logfile --- Engine/source/platform/platformMemory.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Engine/source/platform/platformMemory.cpp b/Engine/source/platform/platformMemory.cpp index 8bd120c1c..6bc2b0447 100644 --- a/Engine/source/platform/platformMemory.cpp +++ b/Engine/source/platform/platformMemory.cpp @@ -37,6 +37,7 @@ #else #include #endif +#include // If profile paths are enabled, disable profiling of the // memory manager as that would cause a cyclic dependency @@ -73,7 +74,7 @@ namespace Memory static U32 allocCount = 0; static U32 currentAllocId = 0; static bool initialized = false; - char gLogFilename[256] = "memlog.txt"; + char gLogFilename[256] = { 0 }; bool gStackTrace = false; void init() @@ -84,6 +85,10 @@ namespace Memory currentAllocId = 0; initialized = true; + // Generate timestamped log filename + std::time_t now = std::time(nullptr); + std::tm* localTime = std::localtime(&now); + std::strftime(gLogFilename, sizeof(gLogFilename), "memlog_%Y-%m-%d_%H-%M-%S.txt", localTime); } void shutdown()