Looking For A Stop Watch Object With Floating Point Support
idbruce
Posts: 6,197
Hello Everyone
Does anyone know of an existing object that can be used as a stop watch for code execution and includes floating point support?
Thanks in advance.
Bruce
Does anyone know of an existing object that can be used as a stop watch for code execution and includes floating point support?
Thanks in advance.
Bruce
Comments
I was going to try and represent my idea with code, but I think a description would be much simpler.
My main product line includes six different sizes. To make the product for a specific size, a block of code is executed with a specified set of variables. To execute this block of code, there is an elapsed time from start to finish, and it is elapsed time that I want to measure. However, instead of a result that ends 5 seconds and 3 milliseconds, I want a result of 5.003 seconds to display on a LCD.
Bruce
all calculatins are done in milliseconds.
seconds := All_The_milliseconds / 1000
milliseconds := seconds // 1000 (modulus operator)
lcd.dec (seconds)
lcd.tx(".")
lcd.dec(millisecond)
keep the questions coming
best regards
Stefan
Well that was a pretty fast and decent solution. Thanks Stefan. I apologize for getting upset with you a couple weeks ago. Sorry.
Bruce
Duane
Edit: It's called pseudo real not pseudo random.
Stefans code will show 5.3 and not 5.003 in this case. You can calculate every decimal place separatly to get the correct result: But I''ve seen dec-methodes with an additional dec-point several times in this forum, just don't find it now.
Andy
thanks for clearing up this.
This is the difference between quick and dirty just writing code and carefully having tested code.
keep the corrections coming
best regards
Stefan