Exemplo n.º 1
0
        public void RoundTo(DefaultLockTimeRoundingMode roundingMode)
        {
            var now     = DateTime.UtcNow;
            var rounded = GetRoundedDate(now, roundingMode);

            _diff = rounded - now;
        }
Exemplo n.º 2
0
        private DateTime GetRoundedDate(DateTime dt, DefaultLockTimeRoundingMode roundingMode)
        {
            var rounding = _roundingForMode.GetOrAdd(roundingMode, mode => new DefaultLockTimeRounding(mode));

            return(rounding.Round(dt));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultLockTimeRounding"/> class.
 /// </summary>
 /// <param name="roundingMode">The rounding mode</param>
 public DefaultLockTimeRounding(DefaultLockTimeRoundingMode roundingMode)
 {
     _roundingMode = roundingMode;
 }