using System; using System.Collections; using System.Text; namespace GisSharpBlog.NetTopologySuite.Utilities { /// /// Implements a timer function which can compute /// elapsed time as well as split times. /// public class Stopwatch { private DateTime startTime; /// /// /// public Stopwatch() { startTime = DateTime.Now; } /// /// /// public void Start() { startTime = DateTime.Now; } /// /// /// public int Time { get { DateTime endTime = DateTime.Now; TimeSpan totalTime = endTime - startTime; return totalTime.Milliseconds; } } /// /// /// public String TimeAsString { get { int totalTime = Time; string totalTimeStr = totalTime < 10000 ? totalTime + " ms" : (double)totalTime / 1000.0 + " s"; return totalTimeStr; } } } }