Skip to content

Instantly share code, notes, and snippets.

@monyskynet
Created July 26, 2013 01:55
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 monyskynet/6085437 to your computer and use it in GitHub Desktop.
Save monyskynet/6085437 to your computer and use it in GitHub Desktop.
Get executing time
Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); Thread.Sleep(10000); stopWatch.Stop(); // Get the elapsed time as a TimeSpan value. TimeSpan ts = stopWatch.Elapsed; // Format and display the TimeSpan value. string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); Console.WriteLine("RunTime " + elapsedTime);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment