Struct std.datetime.stopwatch.StopWatch
StopWatch is used to measure time just like one would do with a physical stopwatch, including stopping, restarting, and/or resetting it.
						
				struct StopWatch
				;
						
					
				MonoTime is used to hold the time, and it uses the system's
    monotonic clock, which is high precision and never counts backwards (unlike
    the wall clock time, which can count backwards, which is why
    SysTime should not be used for timing).
Note that the precision of StopWatch differs from system to system. It is impossible for it to be the same for all systems, since the precision of the system clock and other system-dependent and situation-dependent factors (such as the overhead of a context switch between threads) varies from system to system and can affect StopWatch's accuracy.
Constructors
| Name | Description | 
|---|---|
| this | Constructs a StopWatch. Whether it starts immediately depends on the AutoStartargument. | 
Properties
| Name | Type | Description | 
|---|---|---|
| running[get] | bool | Returns whether this StopWatch is currently running. | 
Methods
| Name | Description | 
|---|---|
| peek | Peek at the amount of time that the the StopWatch has been running. | 
| reset | Resets the StopWatch. | 
| setTimeElapsed | Sets the total time which the StopWatch has been running (i.e. what peek returns). | 
| start | Starts the StopWatch. | 
| stop | Stops the StopWatch. | 
Example
Measure a time in milliseconds, microseconds, or nanoseconds
auto sw = StopWatch(AutoStartExample
import coreAuthors
Jonathan M Davis and Kato Shoichi