Add virtual dtors to time service code

This commit is contained in:
Billy Laws 2021-10-30 21:18:46 +01:00 committed by PixelyIon
parent fd8e843c6c
commit 60fbfad4bc
2 changed files with 14 additions and 1 deletions

View File

@ -19,6 +19,7 @@ namespace skyline::service::timesrv::core {
* @brief A steady clock provides a monotonically increasing timepoint calibrated from a specific base * @brief A steady clock provides a monotonically increasing timepoint calibrated from a specific base
*/ */
class SteadyClockCore { class SteadyClockCore {
private:
bool rtcResetDetected{}; //!< True if the RTC this clock is based off has reset before this boot. bool rtcResetDetected{}; //!< True if the RTC this clock is based off has reset before this boot.
bool initialized{}; //!< If this clock is calibrated with offsets etc and ready for use by applications bool initialized{}; //!< If this clock is calibrated with offsets etc and ready for use by applications
@ -32,6 +33,8 @@ namespace skyline::service::timesrv::core {
} }
public: public:
virtual ~SteadyClockCore() = default;
bool IsRtcResetDetected() { bool IsRtcResetDetected() {
return rtcResetDetected; return rtcResetDetected;
} }
@ -96,6 +99,7 @@ namespace skyline::service::timesrv::core {
* @brief The standard steady clock is calibrated against system RTC time and is used as a base for all clocks aside from alarms and ephemeral * @brief The standard steady clock is calibrated against system RTC time and is used as a base for all clocks aside from alarms and ephemeral
*/ */
class StandardSteadyClockCore : public SteadyClockCore { class StandardSteadyClockCore : public SteadyClockCore {
private:
std::mutex mutex; //!< Protects accesses to cachedValue std::mutex mutex; //!< Protects accesses to cachedValue
TimeSpanType testOffset{}; TimeSpanType testOffset{};
TimeSpanType internalOffset{}; TimeSpanType internalOffset{};
@ -163,6 +167,8 @@ namespace skyline::service::timesrv::core {
public: public:
SystemClockCore(SteadyClockCore &steadyClock) : steadyClock(steadyClock) {} SystemClockCore(SteadyClockCore &steadyClock) : steadyClock(steadyClock) {}
virtual ~SystemClockCore() = default;
void AddOperationEvent(const std::shared_ptr<kernel::type::KEvent> &event) { void AddOperationEvent(const std::shared_ptr<kernel::type::KEvent> &event) {
updateCallback->AddOperationEvent(event); updateCallback->AddOperationEvent(event);
} }
@ -254,7 +260,12 @@ namespace skyline::service::timesrv::core {
public: public:
std::shared_ptr<kernel::type::KEvent> automaticCorrectionUpdatedEvent; std::shared_ptr<kernel::type::KEvent> automaticCorrectionUpdatedEvent;
StandardUserSystemClockCore(const DeviceState &state, StandardSteadyClockCore &standardSteadyClock, StandardLocalSystemClockCore &localSystemClock, StandardNetworkSystemClockCore &networkSystemClock, TimeSharedMemory &timeSharedMemory) : SystemClockCore(standardSteadyClock), localSystemClock(localSystemClock), networkSystemClock(networkSystemClock), automaticCorrectionUpdatedEvent(std::make_shared<kernel::type::KEvent>(state, false)), timeSharedMemory(timeSharedMemory) {} StandardUserSystemClockCore(const DeviceState &state, StandardSteadyClockCore &standardSteadyClock, StandardLocalSystemClockCore &localSystemClock, StandardNetworkSystemClockCore &networkSystemClock, TimeSharedMemory &timeSharedMemory)
: SystemClockCore(standardSteadyClock),
localSystemClock(localSystemClock),
networkSystemClock(networkSystemClock),
automaticCorrectionUpdatedEvent(std::make_shared<kernel::type::KEvent>(state, false)),
timeSharedMemory(timeSharedMemory) {}
void Setup(bool enableAutomaticCorrection, const SteadyClockTimePoint &automaticCorrectionUpdateTime); void Setup(bool enableAutomaticCorrection, const SteadyClockTimePoint &automaticCorrectionUpdateTime);

View File

@ -63,6 +63,8 @@ namespace skyline::service::timesrv::core {
void SignalOperationEvent(); void SignalOperationEvent();
public: public:
virtual ~SystemClockContextUpdateCallback() = default;
/** /**
* @brief Adds an operation event to be siignalled on context updates * @brief Adds an operation event to be siignalled on context updates
*/ */