36 lines
No EOL
555 B
C#
Executable file
36 lines
No EOL
555 B
C#
Executable file
using System;
|
||
|
||
namespace SBRL.Utilities
|
||
{
|
||
public class Timer
|
||
{
|
||
public DateTime StartTime { get; private set; }
|
||
|
||
public Timer() { }
|
||
|
||
public static Timer GetStarted()
|
||
{
|
||
Timer result = new Timer();
|
||
result.Start();
|
||
return result;
|
||
}
|
||
|
||
public void Start()
|
||
{
|
||
StartTime = DateTime.Now;
|
||
}
|
||
|
||
public float GetElapsedSeconds()
|
||
{
|
||
DateTime now = DateTime.Now;
|
||
TimeSpan elasped = now - StartTime;
|
||
StartTime = now;
|
||
return (float)elasped.Ticks / TimeSpan.TicksPerSecond;
|
||
}
|
||
|
||
public void Reset()
|
||
{
|
||
Start();
|
||
}
|
||
}
|
||
} |