Microsoft KB Archive/20551

= TIMER Sometimes Returns Number One Less Than Previous Value =

Article ID: 20551

Article Last Modified on 10/20/2003

-

APPLIES TO


 * Microsoft QuickBasic Compiler for Macintosh 1.0
 * Microsoft QuickBasic Compiler for Macintosh 1.0
 * Microsoft QuickBasic Compiler for Macintosh 1.0

-



This article was previously published under Q20551



SUMMARY
There is a problem in the Macintosh ROM (both 64K and 128K ROMs) that, every one to five minutes, causes the TIMER function in QuickBASIC or BASIC to return a number that is one less than the previous value.



MORE INFORMATION
The following program demonstrates this ROM problem: Loop: Newtime=TIMER IF Newtime < Oldtime THEN GOSUB Ouch Oldtime=Newtime GOTO Loop Ouch: BEEP PRINT "Newtime",Newtime,"Oldtime",Oldtime PRINT "Timer",TIMER RETURN To duplicate the problem, run this program for ten minutes. The subroutine should print only when the TIMER wraps around from the highest value back to zero, but instead, it prints every one to five minutes when TIMER mistakenly returns a number that is one less than the previous value of TIMER. The problem is in the Macintosh ROM routine Readdatetime that is called by TIMER. The problem may have to do with a software/hardware clock updating idiosyncrasy in Readdatetime.

This behavior is not due to a fault in QuickBASIC or BASIC; it is an Apple Macintosh ROM problem.

To work around the problem, you can use PEEK(527), which counts from 0 to 255 by seconds, or use ON TIMER(1) GOSUB and increment a second counter.

Additional query words: MQuickB

Keywords: KB20551

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.