// SetStandardUserSystemClockAutomaticCorrectionEnabled(b8) public ResultCode SetStandardUserSystemClockAutomaticCorrectionEnabled(ServiceCtx context) { SteadyClockCore steadyClock = _timeManager.StandardSteadyClock; StandardUserSystemClockCore userClock = _timeManager.StandardUserSystemClock; if (!userClock.IsInitialized() || !steadyClock.IsInitialized()) { return(ResultCode.UninitializedClock); } if ((_permissions & TimePermissions.UserSystemClockWritableMask) == 0) { return(ResultCode.PermissionDenied); } bool autoCorrectionEnabled = context.RequestData.ReadBoolean(); ITickSource tickSource = context.Device.System.TickSource; ResultCode result = userClock.SetAutomaticCorrectionEnabled(tickSource, autoCorrectionEnabled); if (result == ResultCode.Success) { _timeManager.SharedMemory.SetAutomaticCorrectionEnabled(autoCorrectionEnabled); SteadyClockTimePoint currentTimePoint = userClock.GetSteadyClockCore().GetCurrentTimePoint(tickSource); userClock.SetAutomaticCorrectionUpdatedTime(currentTimePoint); userClock.SignalAutomaticCorrectionEvent(); } return(result); }
[CommandHipc(201)] // 6.0.0+ // GetStandardUserSystemClockAutomaticCorrectionUpdatedTime() -> nn::time::SteadyClockTimePoint public ResultCode GetStandardUserSystemClockAutomaticCorrectionUpdatedTime(ServiceCtx context) { StandardUserSystemClockCore userClock = _timeManager.StandardUserSystemClock; if (!userClock.IsInitialized()) { return(ResultCode.UninitializedClock); } context.ResponseData.WriteStruct(userClock.GetAutomaticCorrectionUpdatedTime()); return(ResultCode.Success); }
// IsStandardUserSystemClockAutomaticCorrectionEnabled() -> bool public ResultCode IsStandardUserSystemClockAutomaticCorrectionEnabled(ServiceCtx context) { StandardUserSystemClockCore userClock = _timeManager.StandardUserSystemClock; if (!userClock.IsInitialized()) { return(ResultCode.UninitializedClock); } context.ResponseData.Write(userClock.IsAutomaticCorrectionEnabled()); return(ResultCode.Success); }
// TODO: 9.0.0+ power states and alarms public TimeManager() { StandardSteadyClock = new StandardSteadyClockCore(); TickBasedSteadyClock = new TickBasedSteadyClockCore(); StandardLocalSystemClock = new StandardLocalSystemClockCore(StandardSteadyClock); StandardNetworkSystemClock = new StandardNetworkSystemClockCore(StandardSteadyClock); StandardUserSystemClock = new StandardUserSystemClockCore(StandardLocalSystemClock, StandardNetworkSystemClock); TimeZone = new TimeZoneContentManager(); EphemeralNetworkSystemClock = new EphemeralNetworkSystemClockCore(StandardSteadyClock); SharedMemory = new TimeSharedMemory(); LocalClockContextWriter = new LocalSystemClockContextWriter(SharedMemory); NetworkClockContextWriter = new NetworkSystemClockContextWriter(SharedMemory); EphemeralClockContextWriter = new EphemeralNetworkSystemClockContextWriter(); }