fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. using System.Diagnostics;
  7.  
  8. namespace TimeSpanTest
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. TimeSpan TS = new TimeSpan(0, 0, 0, 2, 500);
  15. Stopwatch SW = new Stopwatch();
  16.  
  17. SW.Start();
  18.  
  19. Console.WriteLine("Start:[{0}]",DateTime.Now);
  20.  
  21. while (TS > SW.Elapsed) System.Threading.Thread.Sleep(100);
  22.  
  23. Console.WriteLine("End:[{0}]",DateTime.Now);
  24.  
  25. return;
  26. }
  27. }
  28. }
Success #stdin #stdout 0.04s 37112KB
stdin
Standard input is empty
stdout
Start:[2/10/2012 10:42:06 AM]
End:[2/10/2012 10:42:09 AM]