Qbasicnews.com

Full Version: Timer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
It seems the TIMER function only "ticks" ever 1 second. What is the timer that ticks ever 19.2 seconds?

Wow, that is pretty crappy though, I am used to QueryPerformanceFrequency/QueryPerformaceCounter from the Win32 API. The exact numer varies per computer, but the timer it uses updates several thousand times per millisecond.
TIMER ticks 18.2 times a second, but it will seem to tick only every second of you store the result in an integer.

Try this:
Code:
DO
   t& = TIMER
   t! = TIMER
   PRINT t&, t!  
LOOP UNTIL LEN(INKEY$)
Okay, thanks!! Wow, this is weird, I remember in the help file it saying 18.2 from a long time ago, but now it only says it updates every one second. Thanks for the info!
Remember to check for the midnight rollover. I use this everytime I use timers:

FUNCTION TimerFix! (ST!, FT!)

TimerFix! = FT! - ST! - (86400 * (FT! < ST!))

END FUNCTION

Just send your Start timer and Finish Time. If there's a rollover, it will return the adjusted time difference.