Created
August 25, 2017 22:57
-
-
Save MarkPflug/0a58b5cb44647f348f97c5c4b37f7db9 to your computer and use it in GitHub Desktop.
Test DateTime.UtcNow resolution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int total = 0; | |
int count = 0; | |
while (true) { | |
count++; | |
var start = DateTime.UtcNow; | |
for (int i = 0; ; i++) { | |
var now = DateTime.UtcNow; | |
if (now > start) { | |
total += i; | |
var avg = total / count; | |
Console.WriteLine(avg + " " + (now - start).ToString()); | |
start = now; | |
break; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment