{->>>>MarkTime<<<<---------------------------------------------} { } { Filename: MARKTIME.SRC -- Last Modified 10/26/85 } { } { This routine returns in TimeRec Delta the time difference } { between the time passed to it in Mark and the current time. } { It requires a prior definition of type TimeRec: } { } { TimeRec = Record } { TimeComp : Integer; } { TimeString : String80; } { Hours,Minutes,Seconds,Hundredths : Integer } { END; } { } { NOTE: This routine will not operate correctly for intervals } { longer than 24 hours! } {--------------------------------------------------------------} PROCEDURE MarkTime(Var Mark,Delta : TimeRec); TYPE Reg = RECORD CASE Boolean OF False : (Word : Integer); True : (LoByte,HiByte : Byte) END; Regpack = RECORD AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags : Reg END; VAR TempTime : TimeRec; TempSeconds,DeltaSeconds : Real; FUNCTION TimeToSeconds(T : TimeRec) : Real; BEGIN WITH T DO TimeToSeconds := (Hours * 3600) + (Minutes * 60) + Seconds + (Hundredths * 0.01); END; BEGIN GetTime(TempTime); IF TempTime.TimeComp < Mark.TimeComp THEN BEGIN TempSeconds := TimeToSeconds(Mark) + 86400.0; DeltaSeconds := TimeToSeconds(TempTime) - TempSeconds END ELSE DeltaSeconds := TimeToSeconds(TempTime)-TimeToSeconds(Mark); WITH Delta DO BEGIN Hundredths := Trunc(Frac(DeltaSeconds) * 100); DeltaSeconds := Int(DeltaSeconds); TempSeconds := Int(DeltaSeconds / 3600.0); Hours := Trunc(TempSeconds); DeltaSeconds := DeltaSeconds - (Hours * 3600.0); Minutes := Trunc(DeltaSeconds / 60); Seconds := Trunc(DeltaSeconds - (Minutes * 60.0)); END END;