diff options
| author | JMC47 <JMC4789@gmail.com> | 2023-06-21 11:09:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-21 11:09:02 -0400 |
| commit | 6c50de06be787723b903e027abbd8dcade520369 (patch) | |
| tree | af3914f727c82e79f75a7bde24c51d92df5733f6 /Source | |
| parent | 5ad2d86cc7b0356b7ea04e5bc9e50013fdf5a3b4 (diff) | |
| parent | bc0e8158b3da9a88f7ce1c3413fcc22bcff1e30d (diff) | |
Merge pull request #11983 from noahpistilli/fix-kd-utc
IOS/KD/Time: Take into account DST for AdjustedUTC
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/IOS/Network/KD/NetKDTime.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Source/Core/Core/IOS/Network/KD/NetKDTime.cpp b/Source/Core/Core/IOS/Network/KD/NetKDTime.cpp index e267dadf17..6764be4053 100644 --- a/Source/Core/Core/IOS/Network/KD/NetKDTime.cpp +++ b/Source/Core/Core/IOS/Network/KD/NetKDTime.cpp @@ -91,19 +91,29 @@ u64 NetKDTimeDevice::GetAdjustedUTC() const { using namespace ExpansionInterface; + time_t dst_diff{}; const time_t current_time = CEXIIPL::GetEmulatedTime(GetSystem(), CEXIIPL::UNIX_EPOCH); tm* const gm_time = gmtime(¤t_time); + const u32 emulated_time = mktime(gm_time); - return u64(s64(emulated_time) + utcdiff); + if (gm_time->tm_isdst == 1) + dst_diff = 3600; + + return u64(s64(emulated_time) + utcdiff - dst_diff); } void NetKDTimeDevice::SetAdjustedUTC(u64 wii_utc) { using namespace ExpansionInterface; + time_t dst_diff{}; const time_t current_time = CEXIIPL::GetEmulatedTime(GetSystem(), CEXIIPL::UNIX_EPOCH); tm* const gm_time = gmtime(¤t_time); + const u32 emulated_time = mktime(gm_time); - utcdiff = s64(emulated_time - wii_utc); + if (gm_time->tm_isdst == 1) + dst_diff = 3600; + + utcdiff = s64(emulated_time - wii_utc - dst_diff); } } // namespace IOS::HLE |
