home *** CD-ROM | disk | FTP | other *** search
- {->>>>MarkTime<<<<---------------------------------------------}
- { 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 }
- { DayOfWeek, }
- { Hours,Minutes,Seconds,Hundredths : Integer }
- { End; }
- {--------------------------------------------------------------}
-
- Procedure MarkTime(Var Mark,Delta : TimeRec);
-
- Type Reg = Record
- Case Boolean of
- True : (Word : Integer);
- False: (LoByte : Byte;
- 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.DayOfWeek = Mark.DayOfWeek then
- DeltaSeconds := TimeToSeconds(TempTime)-TimeToSeconds(Mark)
- Else
- Begin
- TempSeconds := TimeToSeconds(Mark) + 86400.0;
- DeltaSeconds := TimeToSeconds(TempTime) - TempSeconds
- End;
- With Delta Do
- Begin
- Hundredths := Trunc(Frac(DeltaSeconds) * 100);
- DeltaSeconds := Int(DeltaSeconds);
- Hours := Trunc(DeltaSeconds / 3600.0);
- DeltaSeconds := DeltaSeconds - (Hours * 3600.0);
- Minutes := Trunc(DeltaSeconds / 60);
- Seconds := Trunc(DeltaSeconds - (Minutes * 60.0));
- End
- End;