2021-08-23 16:50:18 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Flowframes.MiscUtils
|
|
|
|
|
|
{
|
|
|
|
|
|
class NmkdStopwatch
|
|
|
|
|
|
{
|
2022-09-14 09:32:05 +02:00
|
|
|
|
public Stopwatch Sw = new Stopwatch();
|
|
|
|
|
|
public TimeSpan Elapsed { get { return Sw.Elapsed; } }
|
|
|
|
|
|
public long ElapsedMs { get { return Sw.ElapsedMilliseconds; } }
|
2021-08-23 16:50:18 +02:00
|
|
|
|
|
2021-12-06 22:46:39 +01:00
|
|
|
|
public NmkdStopwatch(bool startOnCreation = true)
|
2021-08-23 16:50:18 +02:00
|
|
|
|
{
|
|
|
|
|
|
if (startOnCreation)
|
2022-09-14 09:32:05 +02:00
|
|
|
|
Sw.Restart();
|
2021-08-23 16:50:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-06 22:46:39 +01:00
|
|
|
|
public override string ToString()
|
2021-08-23 16:50:18 +02:00
|
|
|
|
{
|
2022-09-14 09:32:05 +02:00
|
|
|
|
return FormatUtils.TimeSw(Sw);
|
2021-08-23 16:50:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|