7.6. Stopwatch: Timer with Microsecond Accuracy

stopwatch is a simple class to measure time with microsecond accuracy. This does not generate events (see the timer/event section for that), but merely provides a way to tell time. This class uses the gettimeofday system call and can be used in compiled code.

7.6.0. (new stopwatch)
[CLASS] (lsh/libc/stopwatch.lsh)

create a new stopwatch

7.6.1. (==> stopwatch get)
[MSG] (lsh/libc/stopwatch.lsh)

get the time in seconds since the last call to reset, or since the creation of the stopwatch. The time is returned in seconds (with one microsecond accuracy) as a double precision floating point number.

7.6.2. (==> stopwatch reset)
[MSG] (lsh/libc/stopwatch.lsh)

resets the reference time of the stopwatch relative to which subsequent times will be measured.