It worksby (no login)That loop was intentionally left empty since some people might have really slow computers. xD Besides, it makes it smaller, shorter, simpler. I like things to be simple when possible. The timer sub waits until the beginning of a second, then starts looping until a whole second has passed. It counts how many times the empty loop has looped in that one second, then stores that number in a shared variable. Whenever you call the SNOOZE sub, you give it a number in seconds. Unlike SLEEP, however, this number doesn't have to be an integer. The SNOOZE sub uses the stored integer to calculate how many times it would have to loop through an empty loop to expend the amount of time you specified. You see, it's actually using the fact that TIME$ changes only once every second. You could use it for milliseconds by assigning thousandths of second, but it's really designed to be decimals of seconds. By the way, SNOOZE 0 doesn't take any time at all, and I didn't make it so a key would exit the loop. It could probably be added, but what's the point? If you can't wait less than a second to interrupt the program, you have a serious problem with your patience. |