using System;
<summary>
</summary>
public sealed class SimpleStopWatch
{
private DateTime mStartedDateTime;
<summary>
</summary>
public string ElapsedTime { get; private set; }
<summary>
</summary>
public void Start()
{
mStartedDateTime = DateTime.Now;
}
<summary>
</summary>
public void Stop()
{
var ts = DateTime.Now - mStartedDateTime;
ElapsedTime = string.Format(
"{0:00}:{1:00}:{2:00}.{3:00}",
ts.Hours,
ts.Minutes,
ts.Seconds,
ts.Milliseconds / 10
);
}
}
var sw = new SimpleStopWatch();
sw.Start();
...
sw.Stop();
Debug.Log( sw.ElapsedTime );