mirror of https://github.com/PCSX2/pcsx2.git
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:
parent
1565c59714
commit
3333553b24
|
@ -88,9 +88,6 @@ static auto last = std::chrono::time_point<std::chrono::system_clock>();
|
||||||
|
|
||||||
MemoryCardFileEntryDateTime MemoryCardFileEntryDateTime::FromTime(time_t time)
|
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 = {};
|
struct tm converted = {};
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
gmtime_s(&converted, &time);
|
gmtime_s(&converted, &time);
|
||||||
|
@ -118,7 +115,12 @@ time_t MemoryCardFileEntryDateTime::ToTime() const
|
||||||
converted.tm_mday = day;
|
converted.tm_mday = day;
|
||||||
converted.tm_mon = std::max(static_cast<int>(month) - 1, 0);
|
converted.tm_mon = std::max(static_cast<int>(month) - 1, 0);
|
||||||
converted.tm_year = std::max(static_cast<int>(year) - 1900, 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()
|
FolderMemoryCard::FolderMemoryCard()
|
||||||
|
|
Loading…
Reference in New Issue