Fixed runtime resolution and parsing
continuous-integration/drone/push Build is passing Details

pull/2/head
Xander Sigler 12 months ago
parent d4661430bf
commit 26bf9cd7ec

@ -39,6 +39,9 @@ namespace AdventOfCode.Models
break; break;
} }
timer.Stop(); 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}");
this._response.RunTime = timer.ElapsedTicks.ToString(); this._response.RunTime = timer.ElapsedTicks.ToString();
this._response.Status = true; this._response.Status = true;
} }

@ -25,7 +25,7 @@ namespace AdventOfCode.Models
public string FormatRunTime() public string FormatRunTime()
{ {
var ts = TimeSpan.FromTicks((long)Convert.ToDouble(timeInTicks)); var ts = TimeSpan.FromTicks(long.Parse(timeInTicks));
var microseconds = (ts.Ticks - (ts.Milliseconds * TimeSpan.TicksPerMillisecond)) / (TimeSpan.TicksPerMillisecond / 1000); var microseconds = (ts.Ticks - (ts.Milliseconds * TimeSpan.TicksPerMillisecond)) / (TimeSpan.TicksPerMillisecond / 1000);
return $"Run time is {ts.Minutes}min {ts.Seconds}sec {ts.Milliseconds}ms {microseconds}µs"; return $"Run time is {ts.Minutes}min {ts.Seconds}sec {ts.Milliseconds}ms {microseconds}µs";
} }

Loading…
Cancel
Save