What's up with my use of Timer? - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: What's up with my use of Timer? (/showthread.php?tid=2820) |
What's up with my use of Timer? - PhilOfPerth - 06-24-2024 I'm trying to build a prog to compare different sorting algorithms (yes, I know it's been done a zillion times). But when I try to use Timer to find the execution time, it seems to go back to the Start time, giving me expired time of zero. I've experimented with _Limit, to see if the system was having problems keeping up or something, and these give some expired time, but these depend on what _limit I use, so they alter the readings. In the small sample here, what am I missing? Code: (Select All) DefDbl T RE: What's up with my use of Timer? - SMcNeill - 06-24-2024 To answer your question -- You simply don't have enough data for it to register for how long it takes to sort. 104 elements are sorted in 0.0000000000000000000001 seconds, or so, and your variable type only holds 0.000000001 seconds, or so. It's done before the timer clicks, so 0 zeros is the correct answer. Increase the data pool and you'll see the time increase. Code: (Select All)
RE: What's up with my use of Timer? - PhilOfPerth - 06-24-2024 Huh! So simple! Oh well, at least my programme works! I thought 100 or so was a reasonable set of data. Message to self: think big! Now, on to the other sorts. Thanks Steve! RE: What's up with my use of Timer? - Pete - 06-25-2024 ...or buy the computer I'm using. Hell, cut your data in half and it will still register at least 3-seconds. FREE SHIPPING!!!! Pete RE: What's up with my use of Timer? - PhilOfPerth - 06-25-2024 (06-25-2024, 03:45 AM)Pete Wrote: ...or buy the computer I'm using. Hell, cut your data in half and it will still register at least 3-seconds. Does it still have its wind-up handle? If not, no thanks; it may be a bit hard to get a new one. RE: What's up with my use of Timer? - Pete - 06-25-2024 No, but the squirrel drive went down last month when I forgot to oil the hamster wheel. Pete |