18 using System.Threading;
28 private const int ProcessedDaysCountInvalid = 0;
29 private const int ProcessedDaysCountValid = 1;
33 private readonly DateTime _startUtcTime;
35 private int _processedDays;
36 private int _isProcessedDaysCountValid;
49 if (Interlocked.CompareExchange(ref _isProcessedDaysCountValid, ProcessedDaysCountValid, ProcessedDaysCountInvalid) == ProcessedDaysCountInvalid)
54 _processedDays = (int)(_timeKeeper.UtcTime - _startUtcTime).TotalDays;
56 catch (OverflowException)
61 return _processedDays;
80 _timeKeeper = timeKeeper;
81 _startUtcTime = _timeKeeper.
UtcTime;
82 TotalDays = Convert.ToInt32((endUtcTime.Date - _startUtcTime.Date).TotalDays) + 1;
90 Interlocked.Exchange(ref _isProcessedDaysCountValid, ProcessedDaysCountInvalid);