Microsoft KB Archive/40086: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - "&" to "&")
 
Line 52: Line 52:
'  The array, d%, corresponds to the time/date record. The ROM
'  The array, d%, corresponds to the time/date record. The ROM
'routine expects the time/date record to be passed through the register
'routine expects the time/date record to be passed through the register
'a0, which is the first parameter after the returnarray&. The remaining
'a0, which is the first parameter after the returnarray&. The remaining
'registers are not used, so they are not included.
'registers are not used, so they are not included.
'ON EXIT OF THE ROM ROUTINE
'ON EXIT OF THE ROM ROUTINE
'  The returnarray& will contain the values of the registers that
'  The returnarray& will contain the values of the registers that
'are passed back from the ROM routine. Register d0 will contain the
'are passed back from the ROM routine. Register d0 will contain the
'seconds, which corresponds to returnarray&(2).
'seconds, which corresponds to returnarray&(2).


DIM d%(20),returnarray&(5)
DIM d%(20),returnarray&(5)
d%(0)=1988
d%(0)=1988
d%(1)=11
d%(1)=11
Line 67: Line 67:
d%(5)=5
d%(5)=5
d%(6)=5
d%(6)=5
Secs& = 0
Secs& = 0
ToolBox "I"      'initialize toolbox
ToolBox "I"      'initialize toolbox
ToolBox "R",&HA9C7,returnarray&(0), d%(0)
ToolBox "R",&HA9C7,returnarray&(0), d%(0)
PRINT "Number of seconds:"; returnarray&(2)
PRINT "Number of seconds:"; returnarray&(2)
                 </pre>
                 </pre>



Latest revision as of 14:14, 21 July 2020

Knowledge Base


FIX: Date2Secs MBLC, Bad Seconds for Secs2Date

Article ID: 40086

Article Last Modified on 11/21/2006

This article was previously published under Q40086

SYMPTOMS

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.

MORE INFORMATION

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