2019-12-22 23:49:51 +01:00
|
|
|
// Copyright 2019 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-09-29 05:42:50 +02:00
|
|
|
#include "core/hle/service/kernel_helpers.h"
|
2019-12-22 23:49:51 +01:00
|
|
|
#include "core/hle/service/time/clock_types.h"
|
|
|
|
#include "core/hle/service/time/system_clock_core.h"
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
class System;
|
|
|
|
}
|
|
|
|
|
2021-01-31 10:38:57 +01:00
|
|
|
namespace Kernel {
|
|
|
|
class KEvent;
|
|
|
|
}
|
|
|
|
|
2019-12-22 23:49:51 +01:00
|
|
|
namespace Service::Time::Clock {
|
|
|
|
|
|
|
|
class StandardLocalSystemClockCore;
|
|
|
|
class StandardNetworkSystemClockCore;
|
|
|
|
|
|
|
|
class StandardUserSystemClockCore final : public SystemClockCore {
|
|
|
|
public:
|
2021-05-16 07:46:30 +02:00
|
|
|
StandardUserSystemClockCore(StandardLocalSystemClockCore& local_system_clock_core_,
|
|
|
|
StandardNetworkSystemClockCore& network_system_clock_core_,
|
|
|
|
Core::System& system_);
|
2019-12-22 23:49:51 +01:00
|
|
|
|
2021-09-29 05:42:50 +02:00
|
|
|
~StandardUserSystemClockCore() override;
|
|
|
|
|
2019-12-22 23:49:51 +01:00
|
|
|
ResultCode SetAutomaticCorrectionEnabled(Core::System& system, bool value);
|
|
|
|
|
2021-05-16 07:46:30 +02:00
|
|
|
ResultCode GetClockContext(Core::System& system, SystemClockContext& ctx) const override;
|
2019-12-22 23:49:51 +01:00
|
|
|
|
|
|
|
bool IsAutomaticCorrectionEnabled() const {
|
|
|
|
return auto_correction_enabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetAutomaticCorrectionUpdatedTime(SteadyClockTimePoint steady_clock_time_point) {
|
|
|
|
auto_correction_time = steady_clock_time_point;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2021-04-26 15:11:33 +02:00
|
|
|
ResultCode Flush(const SystemClockContext&) override;
|
2019-12-22 23:49:51 +01:00
|
|
|
|
|
|
|
ResultCode SetClockContext(const SystemClockContext&) override;
|
|
|
|
|
|
|
|
ResultCode ApplyAutomaticCorrection(Core::System& system, bool value) const;
|
|
|
|
|
|
|
|
const SteadyClockTimePoint& GetAutomaticCorrectionUpdatedTime() const {
|
|
|
|
return auto_correction_time;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
StandardLocalSystemClockCore& local_system_clock_core;
|
|
|
|
StandardNetworkSystemClockCore& network_system_clock_core;
|
|
|
|
bool auto_correction_enabled{};
|
|
|
|
SteadyClockTimePoint auto_correction_time;
|
2021-09-29 05:42:50 +02:00
|
|
|
KernelHelpers::ServiceContext service_context;
|
|
|
|
Kernel::KEvent* auto_correction_event;
|
2019-12-22 23:49:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Service::Time::Clock
|