mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Merge pull request #11983 from noahpistilli/fix-kd-utc
IOS/KD/Time: Take into account DST for AdjustedUTC
This commit is contained in:
commit
6c50de06be
@ -91,19 +91,29 @@ u64 NetKDTimeDevice::GetAdjustedUTC() const
|
|||||||
{
|
{
|
||||||
using namespace ExpansionInterface;
|
using namespace ExpansionInterface;
|
||||||
|
|
||||||
|
time_t dst_diff{};
|
||||||
const time_t current_time = CEXIIPL::GetEmulatedTime(GetSystem(), CEXIIPL::UNIX_EPOCH);
|
const time_t current_time = CEXIIPL::GetEmulatedTime(GetSystem(), CEXIIPL::UNIX_EPOCH);
|
||||||
tm* const gm_time = gmtime(¤t_time);
|
tm* const gm_time = gmtime(¤t_time);
|
||||||
|
|
||||||
const u32 emulated_time = mktime(gm_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)
|
void NetKDTimeDevice::SetAdjustedUTC(u64 wii_utc)
|
||||||
{
|
{
|
||||||
using namespace ExpansionInterface;
|
using namespace ExpansionInterface;
|
||||||
|
|
||||||
|
time_t dst_diff{};
|
||||||
const time_t current_time = CEXIIPL::GetEmulatedTime(GetSystem(), CEXIIPL::UNIX_EPOCH);
|
const time_t current_time = CEXIIPL::GetEmulatedTime(GetSystem(), CEXIIPL::UNIX_EPOCH);
|
||||||
tm* const gm_time = gmtime(¤t_time);
|
tm* const gm_time = gmtime(¤t_time);
|
||||||
|
|
||||||
const u32 emulated_time = mktime(gm_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
|
} // namespace IOS::HLE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user