Beispiel #1
0
        public AlignedTimer(AlignedTimerCallback callback, Boolean isBlocking, TimeUnit interval, TimeSpan shift)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            this.callback = callback;

            IsBlocking = isBlocking;

            Interval = interval;

            Shift = shift;

            // Initialize timer
            timer = new Timer(TimerCallback);

            // Calculate current aligned time
            nextInvocationTime = DateTime.UtcNow.Floor(Interval);
        }
Beispiel #2
0
		public AlignedTimer(AlignedTimerCallback callback, Boolean isBlocking, TimeUnit interval, TimeSpan shift)
		{
			if (callback == null)
			{
				throw new ArgumentNullException(nameof(callback));
			}

			this.callback = callback;

			IsBlocking = isBlocking;

			Interval = interval;

			Shift = shift;

			// Initialize timer
			timer = new Timer(TimerCallback);

			// Calculate current aligned time
			nextInvocationTime = DateTime.UtcNow.Floor(Interval);
		}