Skip to content

Instantly share code, notes, and snippets.

@knatten
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knatten/86529563122a342de6bb to your computer and use it in GitHub Desktop.
Save knatten/86529563122a342de6bb to your computer and use it in GitHub Desktop.
using System;
using System.Diagnostics;
using System.Threading;
namespace ConsoleApplication18
{
class Program
{
static void Main(string[] args)
{
new Program().Run();
}
private DateTime _startTime;
private Stopwatch _stopwatch;
private void Run()
{
_startTime = DateTime.Now;
_stopwatch = new Stopwatch();
_stopwatch.Start();
while (true)
{
Print();
Thread.Sleep(10000);
}
}
private void Print()
{
var watchDiff = _stopwatch.Elapsed.TotalMilliseconds;
var dateDiff = (DateTime.Now - _startTime).TotalMilliseconds;
Console.WriteLine("StopWatch : {0:F1} DateTime : {1:F1} Diff : {2:F2}" , watchDiff, dateDiff, dateDiff-watchDiff);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment