Reverted ISystemClock to use DateTimeOffset
This commit is contained in:
parent
7f025a6bd4
commit
67a0f2d420
|
|
@ -28,7 +28,6 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
private long _lastRequestSeenTicks;
|
private long _lastRequestSeenTicks;
|
||||||
private long _lastReadDateTimeTicks;
|
private long _lastReadDateTimeTicks;
|
||||||
private readonly bool _is64BitSystem;
|
private readonly bool _is64BitSystem;
|
||||||
private readonly long _ticksInOneSecond;
|
|
||||||
private volatile bool _timerIsRunning;
|
private volatile bool _timerIsRunning;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -141,7 +140,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
private void TimerLoop(object state)
|
private void TimerLoop(object state)
|
||||||
{
|
{
|
||||||
var now = _systemClock.UtcNow;
|
var now = _systemClock.UtcNow;
|
||||||
var lastReadDateTime = new DateTime(ReadLongThreadSafe(ref _lastReadDateTimeTicks));
|
var lastReadDateTime = new DateTimeOffset(ReadLongThreadSafe(ref _lastReadDateTimeTicks), TimeSpan.Zero);
|
||||||
|
|
||||||
//Are we in a new second?
|
//Are we in a new second?
|
||||||
if (now - lastReadDateTime >= TimeSpan.FromSeconds(1) || now.Second != lastReadDateTime.Second)
|
if (now - lastReadDateTime >= TimeSpan.FromSeconds(1) || now.Second != lastReadDateTime.Second)
|
||||||
|
|
@ -189,8 +188,8 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets date values from a provided ticks value
|
/// Sets date values from a provided ticks value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ticks">A valid ticks value</param>
|
/// <param name="value">A DateTimeOffset value</param>
|
||||||
private void SetDateValues(DateTime value)
|
private void SetDateValues(DateTimeOffset value)
|
||||||
{
|
{
|
||||||
// See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18 for required format of Date header
|
// See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18 for required format of Date header
|
||||||
_dateValue = value.ToString(Constants.RFC1123DateFormat);
|
_dateValue = value.ToString(Constants.RFC1123DateFormat);
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,6 @@ namespace Microsoft.AspNet.Server.Kestrel.Infrastructure
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the current system time in UTC.
|
/// Retrieves the current system time in UTC.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
DateTime UtcNow { get; }
|
DateTimeOffset UtcNow { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,11 @@ namespace Microsoft.AspNet.Server.Kestrel.Infrastructure
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the current system time in UTC.
|
/// Retrieves the current system time in UTC.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime UtcNow
|
public DateTimeOffset UtcNow
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return DateTime.UtcNow;
|
return DateTimeOffset.UtcNow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue