I was thinking of Amiga DOS ticks 50 per second, but the idea is to time code snippets, without having to find out how many times you have to repeat them to have a signifciant number (say 2 significant digits)
Ok. So you simply want to read time repeatadly and stop looping when you have run like 1 second or so? I'm sure there are ways but I have never done it so I can't answer from the top of my head.
Isn't there some TimeOfDay or DateTime function or something in dos.library perhaps?
Software developer for Amiga OS3 and OS4. Develops for OnyxSoft and the Amiga using E and C and occasionally C++
I was thinking of Amiga DOS ticks 50 per second, but the idea is to time code snippets, without having to find out how many times you have to repeat them to have a signifciant number (say 2 significant digits)
I doubt if it's possible to get exact timing with a CLI command. Remember, Amiga is multitasking and the timing command and/or your code snippet could be paused for task switching by the OS.
I was not thinking to use loops, but to avoid them. Using an interpreted language i can time using the system time, which has a precision of 1 sec.
However the OS, i read, maintains a system time in ticks. So i just wondered if i can use this. If somebody has made a CLI command getting it, it might not be fully usable due to multitasking, i still would be interested; I would try to use it right now. I am interested in the source too of course (or snippet of anybody having used the corresponding OS4 call), but then i'l have to take up C again, which i can't before fall.
It tries to be as accurate as possible and consequently it doesn't report the result in Ticks but you could make that happen by modifying the source code a bit.
@thomas On OS4 version seems like a good idea @alexC Thanks too: works OK, the ticks are not important ,i just started with the idea that this had more chances to be available.
@collinw sure an interesting thing to know. thanks The other solutions have the advantage, that you can include them in a script, which was what i was looking for.
@colinw Has that variable always been available in AmigaOS or is it new to OS4?? Is there a way to list all the local variables from the command line (for future reference).??