From d35a384d2d73104107534c8dd6305f1a9a8bea11 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Wed, 17 Feb 2016 12:10:21 -0800 Subject: [PATCH] Log time from build start instead of absolute time --- .../Microsoft.DotNet.Cli.Build.Framework/BuildReporter.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/Microsoft.DotNet.Cli.Build.Framework/BuildReporter.cs b/scripts/Microsoft.DotNet.Cli.Build.Framework/BuildReporter.cs index bbefb7cf6..4efcba06f 100644 --- a/scripts/Microsoft.DotNet.Cli.Build.Framework/BuildReporter.cs +++ b/scripts/Microsoft.DotNet.Cli.Build.Framework/BuildReporter.cs @@ -4,9 +4,12 @@ namespace Microsoft.DotNet.Cli.Build.Framework { public static class BuildReporter { + private const string TimeSpanFormat = @"hh\:mm\:ss\.fff"; + private static DateTime _initialTime = DateTime.Now; + public static void BeginSection(string type, string name) { - Reporter.Output.WriteLine($"[{type.PadRight(10)} >]".Green() + $" [....] [{DateTime.Now:O}]".Blue() + $" {name}"); + Reporter.Output.WriteLine($"[{type.PadRight(10)} >]".Green() + $" [....] [{(DateTime.Now - _initialTime).ToString(TimeSpanFormat)}]".Blue() + $" {name}"); } public static void EndSection(string type, string name, bool success) @@ -21,7 +24,7 @@ namespace Microsoft.DotNet.Cli.Build.Framework header = header.Red(); } var successString = success ? " OK " : "FAIL"; - Reporter.Output.WriteLine(header + $" [{successString}] [{DateTime.Now:O}]".Blue() + $" {name}"); + Reporter.Output.WriteLine(header + $" [{successString}] [{(DateTime.Now - _initialTime).ToString(TimeSpanFormat)}]".Blue() + $" {name}"); } } }