Kernel: replace usage of Core::System::GetInstance()::Timing()
This commit is contained in:
@ -37,7 +37,7 @@ static std::chrono::seconds GetInitTime() {
|
||||
}
|
||||
}
|
||||
|
||||
Handler::Handler() {
|
||||
Handler::Handler(Core::Timing& timing) : timing(timing) {
|
||||
std::memset(&shared_page, 0, sizeof(shared_page));
|
||||
|
||||
shared_page.running_hw = 0x1; // product
|
||||
@ -54,9 +54,9 @@ Handler::Handler() {
|
||||
init_time = GetInitTime();
|
||||
|
||||
using namespace std::placeholders;
|
||||
update_time_event = Core::System::GetInstance().CoreTiming().RegisterEvent(
|
||||
"SharedPage::UpdateTimeCallback", std::bind(&Handler::UpdateTimeCallback, this, _1, _2));
|
||||
Core::System::GetInstance().CoreTiming().ScheduleEvent(0, update_time_event);
|
||||
update_time_event = timing.RegisterEvent("SharedPage::UpdateTimeCallback",
|
||||
std::bind(&Handler::UpdateTimeCallback, this, _1, _2));
|
||||
timing.ScheduleEvent(0, update_time_event);
|
||||
|
||||
float slidestate =
|
||||
Settings::values.toggle_3d ? (float_le)Settings::values.factor_3d / 100 : 0.0f;
|
||||
@ -66,8 +66,7 @@ Handler::Handler() {
|
||||
/// Gets system time in 3DS format. The epoch is Jan 1900, and the unit is millisecond.
|
||||
u64 Handler::GetSystemTime() const {
|
||||
std::chrono::milliseconds now =
|
||||
init_time + std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
Core::System::GetInstance().CoreTiming().GetGlobalTimeUs());
|
||||
init_time + std::chrono::duration_cast<std::chrono::milliseconds>(timing.GetGlobalTimeUs());
|
||||
|
||||
// 3DS system does't allow user to set a time before Jan 1 2000,
|
||||
// so we use it as an auxiliary epoch to calculate the console time.
|
||||
@ -98,15 +97,14 @@ void Handler::UpdateTimeCallback(u64 userdata, int cycles_late) {
|
||||
shared_page.date_time_counter % 2 ? shared_page.date_time_0 : shared_page.date_time_1;
|
||||
|
||||
date_time.date_time = GetSystemTime();
|
||||
date_time.update_tick = Core::System::GetInstance().CoreTiming().GetTicks();
|
||||
date_time.update_tick = timing.GetTicks();
|
||||
date_time.tick_to_second_coefficient = BASE_CLOCK_RATE_ARM11;
|
||||
date_time.tick_offset = 0;
|
||||
|
||||
++shared_page.date_time_counter;
|
||||
|
||||
// system time is updated hourly
|
||||
Core::System::GetInstance().CoreTiming().ScheduleEvent(msToCycles(60 * 60 * 1000) - cycles_late,
|
||||
update_time_event);
|
||||
timing.ScheduleEvent(msToCycles(60 * 60 * 1000) - cycles_late, update_time_event);
|
||||
}
|
||||
|
||||
void Handler::SetMacAddress(const MacAddress& addr) {
|
||||
|
Reference in New Issue
Block a user