diff --git a/AdventOfCode/Models/AOCDay.cs b/AdventOfCode/Models/AOCDay.cs index 6a31aca..2a99352 100644 --- a/AdventOfCode/Models/AOCDay.cs +++ b/AdventOfCode/Models/AOCDay.cs @@ -25,10 +25,9 @@ namespace AdventOfCode.Models public AOCResponse ExecuteDay(AOCRequest request) { _request = request; - var timer = new Stopwatch(); try { - timer.Start(); + var startTicks = DateTime.UtcNow.Ticks; switch (request.Version) { case AOCVersion.A: @@ -38,12 +37,8 @@ namespace AdventOfCode.Models this._response = ExecutePartB(); break; } - timer.Stop(); - Console.WriteLine($"Elapsed ticks is {timer.ElapsedTicks.ToString()}"); - Console.WriteLine($"System Clock Resolution: {TimeSpan.FromTicks(Stopwatch.Frequency).TotalSeconds} seconds"); - Console.WriteLine($"Local Time Zone: {TimeZoneInfo.Local}"); - Console.WriteLine($"Current System Time: {DateTime.Now}"); - this._response.RunTime = timer.ElapsedTicks.ToString(); + + this._response.RunTime = (DateTime.UtcNow.Ticks - startTicks).ToString(); this._response.Status = true; } catch (Exception e) diff --git a/AdventOfCode/Program.cs b/AdventOfCode/Program.cs index d0d4aa2..75576c7 100644 --- a/AdventOfCode/Program.cs +++ b/AdventOfCode/Program.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; @@ -13,6 +14,9 @@ namespace AdventOfCode { public static void Main(string[] args) { + Console.WriteLine($"System Clock Resolution: {TimeSpan.FromTicks(Stopwatch.Frequency).TotalSeconds} seconds"); + Console.WriteLine($"Local Time Zone: {TimeZoneInfo.Local}"); + Console.WriteLine($"Current System Time: {DateTime.Now}"); CreateHostBuilder(args).Build().Run(); } diff --git a/AdventOfCode/_2023/Day6.cs b/AdventOfCode/_2023/Day6.cs index 9997696..774727b 100644 --- a/AdventOfCode/_2023/Day6.cs +++ b/AdventOfCode/_2023/Day6.cs @@ -1,10 +1,7 @@ using AdventOfCode.Common; using AdventOfCode.Models; -using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; -using System.Threading.Tasks; namespace AdventOfCode._2023 {