// 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); }