Microsoft KB Archive/40086
Article ID: 40086
Article Last Modified on 11/21/2006
This article was previously published under Q40086
The Date2Secs routine (which is an MBLC routine built into QuickBasic for Macintosh) returns an incorrect number of seconds. When the number of seconds is passed back into the corresponding Secs2Date routine, an invalid date is produced.
Microsoft has confirmed this to be a bug in QuickBasic version 1.00. This problem is corrected in QuickBasic version 1.00b.
To work around the problem, it is possible to invoke QuickBasic's TOOLBOX routine with an equivalent Register-based ROM trap function, Date2Secs.
The program provided below demonstrates this procedure. Please remember to set up the date array as described in the "Microsoft QuickBasic for the Macintosh: Basic Language Reference" manual, page 493, before running this sample program.
For a complete description of the ROM routine, please refer to "Inside Macintosh" Volume II, page 379.
The following is a code example:
'ON ENTRY OF THE ROM ROUTINE ' The array, d%, corresponds to the time/date record. The ROM 'routine expects the time/date record to be passed through the register 'a0, which is the first parameter after the returnarray&. The remaining 'registers are not used, so they are not included. 'ON EXIT OF THE ROM ROUTINE ' The returnarray& will contain the values of the registers that 'are passed back from the ROM routine. Register d0 will contain the 'seconds, which corresponds to returnarray&(2). DIM d%(20),returnarray&(5) d%(0)=1988 d%(1)=11 d%(2)=10 d%(3)=5 d%(4)=5 d%(5)=5 d%(6)=5 Secs& = 0 ToolBox "I" 'initialize toolbox ToolBox "R",&HA9C7,returnarray&(0), d%(0) PRINT "Number of seconds:"; returnarray&(2)
Additional query words: MQuickB
Keywords: kbbug kbfix KB40086