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.
I’ve often thought time would be easier if it was decimal with an hour divided into 100 minutes.
I recently saw a presentation on time which noted that 60 was used for dividing minutes and seconds because 60 is divisible by 10 factors 2, 3, 4, 5, 6, 10, 12, 15, 20, 30 making it easy to split an hour fractionally 10 ways into even minutes. Also nice it is divisible by numbers 1 to 6.
Base 60 has a name Sexagesimal that sounds a bit naughty. Maybe a good name for rapper or supermodel.