Posted: Mon Oct 31, 2005 3:21 pm
You can get it to work as long as your loop runs in =< 1 second of time, otherwise it can skip a second every now and then.
Discuss QBasic, Freebasic, QB64 and more
http://petesqbsite.com/phpBB3/
Code: Select all
t! = timer +1
timerem = timestart
'timestart is 300 in this case 5 minutes, set in another spot
DO
If timer = T! then
t! = timer +1
timerem = timerem -1
minuterem = timerem/60
secrem = int(timestart-(minuterem*60)
print fix(minuterem);
print ":";
print 60- secrem
end if
loop
Code: Select all
if len(ltrim$(rtrim$(str$(secrem)))) < 2 then
print "0"+ltrim$(rtrim$(str$(secrem)))
else
print secrem
end if
Code: Select all
t! = timer +1
timerem = timestart
'timestart is 300 in this case 5 minutes, set in another spot
'***NOTE: The following will only work if minutes is less than 60,
' that is, if timestart is less than 3600.
DO
If timer = T! then
t! = timer +1
timerem = timerem -1
rem ... minuterem = timerem/60
rem ...secrem = int(timestart-(minuterem*60)
ISEC=timerem
IF ISEC >= 60 THEN
MM = INT(ISEC/60)
ISEC=ISEC-MM*60
ELSE
MM = 0
END IF
SS = ISEC
print right$("00"+ltrim$(str$(MM)),2);":";
print right$("00"+ltrim$(str$(SS)),2)
end if
loop