diff options
author | Ben Harris <ben@tilde.team> | 2020-12-16 17:17:35 -0500 |
---|---|---|
committer | Ben Harris <ben@tilde.team> | 2020-12-16 17:17:35 -0500 |
commit | 837527d487c7e232b36dd87c95a15b7852f2e057 (patch) | |
tree | 21ddf9a63548ccc8c802fe5f158f3e6743a8e9f1 /lib/Extensions.cs | |
parent | c66d1d6b335e6c2f6b544ae31793f318ba2b99a7 (diff) |
refactor to two-digit day names and add puzzlename
Diffstat (limited to 'lib/Extensions.cs')
-rw-r--r-- | lib/Extensions.cs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Extensions.cs b/lib/Extensions.cs index a1ffbcc..eb8c3cb 100644 --- a/lib/Extensions.cs +++ b/lib/Extensions.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Diagnostics; using System.Linq; namespace aoc2019.lib @@ -28,5 +29,20 @@ namespace aoc2019.lib foreach (var item in sequence) yield return item; } + + /// <summary> + /// increased accuracy for stopwatch based on frequency. + /// <see + /// href="http://geekswithblogs.net/BlackRabbitCoder/archive/2012/01/12/c.net-little-pitfalls-stopwatch-ticks-are-not-timespan-ticks.aspx"> + /// blog + /// details here + /// </see> + /// </summary> + /// <param name="stopwatch"></param> + /// <returns></returns> + public static double ScaleMilliseconds(this Stopwatch stopwatch) + { + return 1_000 * stopwatch.ElapsedTicks / (double) Stopwatch.Frequency; + } } } \ No newline at end of file |