Merge pull request #485 from tmds:dev

Convert Environment Ticks to TimeSpan Ticks
This commit is contained in:
Master T 2015-11-17 20:26:41 +01:00 committed by John Luo
parent d867d2555b
commit 3c1b759750
1 changed files with 4 additions and 2 deletions

View File

@ -10,6 +10,8 @@ namespace Microsoft.AspNet.Hosting.Internal
{
internal static class HostingLoggerExtensions
{
private const long TicksPerMillisecond = 10000;
public static IDisposable RequestScope(this ILogger logger, HttpContext httpContext)
{
return logger.BeginScopeImpl(new HostingLogScope(httpContext));
@ -32,7 +34,7 @@ namespace Microsoft.AspNet.Hosting.Internal
{
if (logger.IsEnabled(LogLevel.Information))
{
var elapsed = new TimeSpan(Environment.TickCount - startTimeInTicks);
var elapsed = new TimeSpan(TicksPerMillisecond * (Environment.TickCount - startTimeInTicks));
logger.Log(
logLevel: LogLevel.Information,
eventId: LoggerEventIds.RequestFinished,
@ -46,7 +48,7 @@ namespace Microsoft.AspNet.Hosting.Internal
{
if (logger.IsEnabled(LogLevel.Information))
{
var elapsed = new TimeSpan(Environment.TickCount - startTimeInTicks);
var elapsed = new TimeSpan(TicksPerMillisecond * (Environment.TickCount - startTimeInTicks));
logger.Log(
logLevel: LogLevel.Information,
eventId: LoggerEventIds.RequestFailed,