FANDOM


//  Stopwatch stopWatch = new Stopwatch();
//  using ( new Timer( stopWatch ) )
//  {
//      Thread.Sleep(1000);
//  }
//  Print Timer.FormatTimeSpan(stopWatch.Elapsed);
//
public class Timer : IDisposable
{
    private Stopwatch stopWatch;

    public Timer(Stopwatch stop)
    {
        this.stopWatch = stop;
        stopWatch.Start();
    }

    public void Dispose()
    {
        stopWatch.Stop();
    }

    public static string FormatTimeSpan(TimeSpan ts)
    {
        return String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);
    }
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.