Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MemoryCardFolder: Fix incorrect save timestamps #10287

Merged
merged 3 commits into from
Nov 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions pcsx2/SIO/Memcard/MemoryCardFolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ static auto last = std::chrono::time_point<std::chrono::system_clock>();

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);
Expand Down Expand Up @@ -118,7 +115,12 @@ time_t MemoryCardFileEntryDateTime::ToTime() const
converted.tm_mday = day;
converted.tm_mon = std::max(static_cast<int>(month) - 1, 0);
converted.tm_year = std::max(static_cast<int>(year) - 1900, 0);
return mktime(&converted);

#ifdef _MSC_VER
return _mkgmtime(&converted);
#else
return timegm(&converted);
#endif
}

FolderMemoryCard::FolderMemoryCard()
Expand Down