MemoryCardFolder: Fix incorrect save timestamps (#10287)

* MemoryCardFolder: Fix incorrect save timestamps

* MemoryCardFolder: move timegm macro to source file

* MemoryCardFolder: remove timegm macro
This commit is contained in:
cyanea-bt 2023-11-19 04:30:10 +01:00 committed by GitHub
parent 1565c59714
commit 3333553b24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -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);
@ -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()