std::chrono cleanup: always use steady_clock

This commit is contained in:
Nekotekina 2020-12-11 16:31:32 +03:00
parent 12a48fc6d1
commit aa3aef4beb
19 changed files with 96 additions and 97 deletions

View file

@ -11,6 +11,7 @@
#include "sceNp.h"
#include "cellSysutil.h"
#include "Emu/Cell/lv2/sys_time.h"
#include "Emu/NP/np_handler.h"
#include "Emu/NP/np_contexts.h"
@ -2519,9 +2520,18 @@ error_code sceNpManagerGetNetworkTime(vm::ptr<CellRtcTick> pTick)
return SCE_NP_ERROR_INVALID_STATE;
}
auto now = std::chrono::system_clock::now();
// That's assuming epoch is unix epoch which is not actually standardized, god I hate you C++ std
pTick->tick = std::chrono::duration_cast<std::chrono::microseconds>(now.time_since_epoch()).count() + (62135596800 * 1000 * 1000);
vm::var<s64> sec;
vm::var<s64> nsec;
error_code ret = sys_time_get_current_time(sec, nsec);
if (ret != CELL_OK)
{
return ret;
}
// Taken from cellRtc
pTick->tick = *nsec / 1000 + *sec * cellRtcGetTickResolution() + 62135596800000000ULL;
return CELL_OK;
}