Fixed runtime resolution and parsing
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Xander Sigler 2023-12-09 20:54:34 -08:00
parent d4661430bf
commit 26bf9cd7ec
2 changed files with 4 additions and 1 deletions

View File

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

View File

@ -25,7 +25,7 @@ namespace AdventOfCode.Models
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);
return $"Run time is {ts.Minutes}min {ts.Seconds}sec {ts.Milliseconds}ms {microseconds}µs";
}