diff --git a/Core/AVIDump.cpp b/Core/AVIDump.cpp index 456698936b..1255f16089 100644 --- a/Core/AVIDump.cpp +++ b/Core/AVIDump.cpp @@ -92,7 +92,7 @@ bool AVIDump::CreateAVI() { // Use gameID_EmulatedTimestamp for filename std::string discID = g_paramSFO.GetDiscID(); - std::string video_file_name = StringFromFormat("%s%s_%d.avi", GetSysDirectory(DIRECTORY_VIDEO).c_str(), discID.c_str(), KernelTimeNow()).c_str(); + std::string video_file_name = StringFromFormat("%s%s %s.avi", GetSysDirectory(DIRECTORY_VIDEO).c_str(), discID.c_str(), KernelTimeNowFormatted().c_str()).c_str(); s_format_context = avformat_alloc_context(); std::stringstream s_file_index_str; diff --git a/Core/HLE/__sceAudio.cpp b/Core/HLE/__sceAudio.cpp index ed9c7c1c76..c6d1dfefc9 100644 --- a/Core/HLE/__sceAudio.cpp +++ b/Core/HLE/__sceAudio.cpp @@ -387,7 +387,7 @@ void __AudioUpdate(bool resetRecording) { if (g_Config.bSaveLoadResetsAVdumping && resetRecording) { __StopLogAudio(); std::string discID = g_paramSFO.GetDiscID(); - std::string audio_file_name = StringFromFormat("%s%s_%d.wav", GetSysDirectory(DIRECTORY_AUDIO).c_str(), discID.c_str(), KernelTimeNow()).c_str(); + std::string audio_file_name = StringFromFormat("%s%s %s.wav", GetSysDirectory(DIRECTORY_AUDIO).c_str(), discID.c_str(), KernelTimeNowFormatted().c_str()).c_str(); INFO_LOG(COMMON, "Restarted audio recording to: %s", audio_file_name.c_str()); if (!File::Exists(GetSysDirectory(DIRECTORY_AUDIO))) File::CreateDir(GetSysDirectory(DIRECTORY_AUDIO)); @@ -398,7 +398,7 @@ void __AudioUpdate(bool resetRecording) { if (g_Config.bDumpAudio) { // Use gameID_EmulatedTimestamp for filename std::string discID = g_paramSFO.GetDiscID(); - std::string audio_file_name = StringFromFormat("%s%s_%d.wav", GetSysDirectory(DIRECTORY_AUDIO).c_str(), discID.c_str(), KernelTimeNow()).c_str(); + std::string audio_file_name = StringFromFormat("%s%s %s.wav", GetSysDirectory(DIRECTORY_AUDIO).c_str(), discID.c_str(), KernelTimeNowFormatted().c_str()).c_str(); INFO_LOG(COMMON,"Recording audio to: %s", audio_file_name.c_str()); // Create the path just in case it doesn't exist if (!File::Exists(GetSysDirectory(DIRECTORY_AUDIO))) diff --git a/Core/HLE/sceKernelTime.cpp b/Core/HLE/sceKernelTime.cpp index a4f2df2a60..19901cc721 100644 --- a/Core/HLE/sceKernelTime.cpp +++ b/Core/HLE/sceKernelTime.cpp @@ -31,6 +31,7 @@ #include "Core/HLE/sceKernelThread.h" #include "Core/HLE/sceRtc.h" #include "Core/MemMap.h" +#include "StringUtils.h" // The time when the game started. static time_t start_time; @@ -172,6 +173,18 @@ u32 sceKernelLibcGettimeofday(u32 timeAddr, u32 tzAddr) return 0; } -u32 KernelTimeNow() { - return (u32)start_time + (u32)(CoreTiming::GetGlobalTimeUs() / 1000000ULL); +std::string KernelTimeNowFormatted() { + time_t emulatedTime = (u32)start_time + (u32)(CoreTiming::GetGlobalTimeUs() / 1000000ULL); + tm* timePtr = localtime(&emulatedTime); + bool DST = timePtr->tm_isdst; + u8 seconds = timePtr->tm_sec; + u8 minutes = timePtr->tm_min; + u8 hours = timePtr->tm_hour; + if (DST) + hours = timePtr->tm_hour + 1; + u8 days = timePtr->tm_mday; + u8 months = timePtr->tm_mon + 1; + u16 years = timePtr->tm_year + 1900; + std::string timestamp = StringFromFormat("%04d-%02d-%02d %02d-%02d-%02d", years, months, days, hours, minutes, seconds).c_str(); + return timestamp; } \ No newline at end of file diff --git a/Core/HLE/sceKernelTime.h b/Core/HLE/sceKernelTime.h index 15c064d7ce..d973c20d40 100644 --- a/Core/HLE/sceKernelTime.h +++ b/Core/HLE/sceKernelTime.h @@ -27,7 +27,7 @@ int sceKernelSysClock2USec(u32 sysclockPtr, u32 highPtr, u32 lowPtr); int sceKernelSysClock2USecWide(u32 lowClock, u32 highClock, u32 lowPtr, u32 highPtr); u64 sceKernelUSec2SysClockWide(u32 usec); u32 sceKernelLibcClock(); -u32 KernelTimeNow(); +std::string KernelTimeNowFormatted(); void __KernelTimeInit(); void __KernelTimeDoState(PointerWrap &p);