public StandardLocalSystemClockCore(SteadyClockCore steadyClockCore)
        {
            _steadyClockCore = steadyClockCore;
            _context         = new SystemClockContext();

            _context.SteadyTimePoint.ClockSourceId = steadyClockCore.GetClockSourceId();
        }
        public StandardNetworkSystemClockCore(SteadyClockCore steadyClockCore)
        {
            _steadyClockCore = steadyClockCore;
            _context         = new SystemClockContext();

            _context.SteadyTimePoint.ClockSourceId  = steadyClockCore.GetClockSourceId();
            _standardNetworkClockSufficientAccuracy = new TimeSpanType(0);
        }
Beispiel #3
0
        public SystemClockCore(SteadyClockCore steadyClockCore)
        {
            _steadyClockCore = steadyClockCore;
            _context         = new SystemClockContext();
            _isInitialized   = false;

            _context.SteadyTimePoint.ClockSourceId = steadyClockCore.GetClockSourceId();
            _systemClockContextUpdateCallback      = null;
        }
        public bool IsStandardNetworkSystemClockAccuracySufficient(KThread thread)
        {
            SteadyClockCore      steadyClockCore  = GetSteadyClockCore();
            SteadyClockTimePoint currentTimePoint = steadyClockCore.GetCurrentTimePoint(thread);

            bool isStandardNetworkClockSufficientAccuracy = false;

            if (_context.SteadyTimePoint.GetSpanBetween(currentTimePoint, out long outSpan) == ResultCode.Success)
            {
                isStandardNetworkClockSufficientAccuracy = outSpan * 1000000000 < _standardNetworkClockSufficientAccuracy.NanoSeconds;
            }

            return(isStandardNetworkClockSufficientAccuracy);
        }
Beispiel #5
0
        public bool IsClockSetup(KThread thread)
        {
            ResultCode result = GetSystemClockContext(thread, out SystemClockContext context);

            if (result == ResultCode.Success)
            {
                SteadyClockCore steadyClockCore = GetSteadyClockCore();

                SteadyClockTimePoint steadyClockTimePoint = steadyClockCore.GetCurrentTimePoint(thread);

                return(steadyClockTimePoint.ClockSourceId == context.SteadyTimePoint.ClockSourceId);
            }

            return(false);
        }
Beispiel #6
0
        public bool IsStandardNetworkSystemClockAccuracySufficient(ITickSource tickSource)
        {
            SteadyClockCore      steadyClockCore  = GetSteadyClockCore();
            SteadyClockTimePoint currentTimePoint = steadyClockCore.GetCurrentTimePoint(tickSource);

            bool isStandardNetworkClockSufficientAccuracy = false;

            ResultCode result = GetClockContext(tickSource, out SystemClockContext context);

            if (result == ResultCode.Success && context.SteadyTimePoint.GetSpanBetween(currentTimePoint, out long outSpan) == ResultCode.Success)
            {
                isStandardNetworkClockSufficientAccuracy = outSpan * 1000000000 < _standardNetworkClockSufficientAccuracy.NanoSeconds;
            }

            return(isStandardNetworkClockSufficientAccuracy);
        }