Opc.Ua.Server.DataChangeMonitoredItem.IncrementSampleTime C# (CSharp) Method

IncrementSampleTime() private method

Increments the sample time to the next interval.
private IncrementSampleTime ( ) : void
return void
        private void IncrementSampleTime()
        {
            // update next sample time.
            long now = DateTime.UtcNow.Ticks;            
            long samplingInterval = (long)(m_samplingInterval*TimeSpan.TicksPerMillisecond);

            if (m_nextSampleTime > 0)
            {
                long delta = now - m_nextSampleTime;

                if (samplingInterval > 0 && delta >= 0)
                {
                    m_nextSampleTime += ((delta/samplingInterval)+1)*samplingInterval;                 
                }
            }

            // set sampling time based on current time.
            else
            {
                m_nextSampleTime = now + samplingInterval;
            }
        }