Based on the .NET Stopwatch Class but only using the precision of Clarion Clock() and Today()
Implemented:
Start
StartNew
Stop
Reset
Restart
Elapsed
ToString
PROGRAM
Include('Stopwatch.inc'),ONCE
MAP
END
SW Stopwatch
CODE
SW.Start()
! Do some things that take time...
! Perhaps Thread.Sleep(10000)
SW.Stop()
Message('Elapsed Ticks: ' & SW.Elapsed())
Message('Time Elapsed: ' & SW.ToString()) ! e.g. 2 days, 00:12:54
But yes, do check out the work from Mark! In this case I just wanted something very self contained.
The IFDEF technique around the EQUATES would be a good safeguard which I failed to include in my original above.