Sign in using Google or Yahoo! id.  

Timing C# applications

 Comments Share:   Twitter   Reddit   HackerNews   Facebook 
using System;
using System.Threading;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            DateTime old = DateTime.Now;
            Thread.Sleep(61000);
            DateTime latest = DateTime.Now;

            TimeSpan diff = latest - old;

            Console.WriteLine(diff.Hours
                + ":"
                + diff.Minutes
                + ":"
                + diff.Seconds);
        }
    }
}
Posted on March 24, 2010 02:42 PM by Subhash Chandran
performance csharp
blog comments powered by Disqus