Skip to content

Commit

Permalink
Merge pull request #11435 from techydude0713/wc24-utc-fix
Browse files Browse the repository at this point in the history
NetKDTime: Use UTC based timestamp instead of localtime.
  • Loading branch information
phire committed Jan 31, 2023
2 parents 0f037a1 + e2db9cd commit 12431a8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Source/Core/Core/IOS/Network/KD/NetKDTime.cpp
Expand Up @@ -91,15 +91,19 @@ u64 NetKDTimeDevice::GetAdjustedUTC() const
{
using namespace ExpansionInterface;

const u32 emulated_time = CEXIIPL::GetEmulatedTime(CEXIIPL::UNIX_EPOCH);
const time_t current_time = CEXIIPL::GetEmulatedTime(CEXIIPL::UNIX_EPOCH);
tm* const gm_time = gmtime(&current_time);
const u32 emulated_time = mktime(gm_time);
return u64(s64(emulated_time) + utcdiff);
}

void NetKDTimeDevice::SetAdjustedUTC(u64 wii_utc)
{
using namespace ExpansionInterface;

const u32 emulated_time = CEXIIPL::GetEmulatedTime(CEXIIPL::UNIX_EPOCH);
const time_t current_time = CEXIIPL::GetEmulatedTime(CEXIIPL::UNIX_EPOCH);
tm* const gm_time = gmtime(&current_time);
const u32 emulated_time = mktime(gm_time);
utcdiff = s64(emulated_time - wii_utc);
}
} // namespace IOS::HLE

0 comments on commit 12431a8

Please sign in to comment.