PROGRAM BYTECalculations
?
?  timing test displayed in TDI Modula 2 advertisement
?  also referred to as "The BYTE Calculations Program"
?  Amazing Computing Volume2 #8,1987 p.75
?  program averages 1.42 seconds
?
?
REAL C,B,A
INTEGER I,N
DATA (N,5000),(A,2.781281828),(B,3.141592654),(C,1.0)
TYPE DateStamp IS RECORD
   INTEGER DAYS,MINUTES,TICKS
ENDTYPE
DateStamp AA,BB

SUBPROGRAM
   SUBROUTINE ElapsedSeconds

I=DOSTIME(@AA)  ; ? get initial system time
FOR I=1 TO N
   C=C*A ; C=C*B ; C=C/A ; C=C/B
NEXT I
I=DOSTIME(@BB) ;  ? get final system time
PRINT "Reported Time:",
ElapsedSeconds(@AA,@BB)
END
SUBROUTINE ElapsedSeconds
PARAMETER
   PTR_TO DateStamp TBEGIN,TEND
LOCAL
   INTEGER TotSeconds
&QUICK 0
TotSeconds=0
TotSeconds=(TEND.DAYS-TBEGIN.DAYS)*4320000+(TEND.MINUTES-TBEGIN.MINUTES)*3000+(TEND.TICKS-TBEGIN.TICKS)
PRINT TotSeconds/(50.0)
GRETURN
END
