From 3333553b2457bbf774389b11317d339ca088cafc Mon Sep 17 00:00:00 2001 From: cyanea-bt <150618858+cyanea-bt@users.noreply.github.com> Date: Sun, 19 Nov 2023 04:30:10 +0100 Subject: [PATCH] MemoryCardFolder: Fix incorrect save timestamps (#10287) * MemoryCardFolder: Fix incorrect save timestamps * MemoryCardFolder: move timegm macro to source file * MemoryCardFolder: remove timegm macro --- pcsx2/SIO/Memcard/MemoryCardFolder.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pcsx2/SIO/Memcard/MemoryCardFolder.cpp b/pcsx2/SIO/Memcard/MemoryCardFolder.cpp index 71ac149cb9..aa3af53224 100644 --- a/pcsx2/SIO/Memcard/MemoryCardFolder.cpp +++ b/pcsx2/SIO/Memcard/MemoryCardFolder.cpp @@ -88,9 +88,6 @@ static auto last = std::chrono::time_point(); MemoryCardFileEntryDateTime MemoryCardFileEntryDateTime::FromTime(time_t time) { - // TODO: Is this safe with regard to DST? - time += MEMORY_CARD_FILE_ENTRY_DATE_TIME_OFFSET; - struct tm converted = {}; #ifdef _MSC_VER gmtime_s(&converted, &time); @@ -118,7 +115,12 @@ time_t MemoryCardFileEntryDateTime::ToTime() const converted.tm_mday = day; converted.tm_mon = std::max(static_cast(month) - 1, 0); converted.tm_year = std::max(static_cast(year) - 1900, 0); - return mktime(&converted); + +#ifdef _MSC_VER + return _mkgmtime(&converted); +#else + return timegm(&converted); +#endif } FolderMemoryCard::FolderMemoryCard()