mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-25 15:30:14 +00:00
Ditch epoch math. Use constant offset
This commit is contained in:
parent
8c14114d6b
commit
fb6bd4d654
@ -11,7 +11,7 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// 3DS Uses 1900 for Epoch instead of 1970
|
// 3DS Uses 1900 for Epoch instead of 1970
|
||||||
#define _3DS_EPOCH_OFFSET 3155673600L
|
#define _3DS_EPOCH_OFFSET 2208988800L
|
||||||
|
|
||||||
namespace SharedPage {
|
namespace SharedPage {
|
||||||
|
|
||||||
@ -37,9 +37,7 @@ static void UpdateTimeCallback(u64 /*userdata*/, int /*cycles_late*/) {
|
|||||||
|
|
||||||
// 3DS uses 1/1/1900 for Epoch
|
// 3DS uses 1/1/1900 for Epoch
|
||||||
time_t plat_time = std::time(nullptr);
|
time_t plat_time = std::time(nullptr);
|
||||||
tm console_epoch = {};
|
u64_le console_time = (static_cast<u64_le>(plat_time) + _3DS_EPOCH_OFFSET) * 1000L;
|
||||||
console_epoch.tm_year = 100; // 2000
|
|
||||||
u64_le console_time = (static_cast<u64_le>(std::difftime(plat_time, std::mktime(&console_epoch))) + _3DS_EPOCH_OFFSET) * 1000L;
|
|
||||||
|
|
||||||
DateTime* current_time = (shared_page.date_time_update_counter & 1) ? &shared_page.date_time_1 : &shared_page.date_time_0;
|
DateTime* current_time = (shared_page.date_time_update_counter & 1) ? &shared_page.date_time_1 : &shared_page.date_time_0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user