(*$M 8192, 0, 9182 *)

Program SE_HALT;
Uses Crt, Dos;

(*
 *  05.02.1995: Creation TL
 *  12.10.2003
 *)

Var ExitSAVE :Pointer;

(*-----*)

Procedure AFF_TIME;
  Var HR, MN, SS, CC :Word;  SW :STRING;
  
  FUNCTION LZ(WW :Word) : STRING;
  Begin
    Str(WW:0, SW); If Length(SW) = 1 THEN LZ:='0'+SW Else LZ:=SW;
  End;
  
Begin
  GetTime(HR, MN, SS, CC);
  WriteLN(LZ(HR), ':', LZ(MN), ':',LZ(SS), '.', LZ(CC));
End;   (* AFF_TIME *)

(*-----*)

(*$F+*) Procedure EPILOGUE;
Begin
  WriteLN; Write('Fin   d''execution : '); AFF_TIME; 
  ExitProc:=ExitSAVE;  (* Restauration ancienne adresse *)
  HALT;
End; (*$F-*)   (* EPILOGUE *)

(*-----*)

Procedure PROLOGUE;
Begin
  WriteLN; Write('D‚but d''execution : '); AFF_TIME;
End;   (* PROLOGUE *)

(*-----*)

Begin  (* Debut *)
  ExitSAVE:=ExitProc;  (* Sauvegarde adresse Procedure FIN Programme *)
  ExitProc:=@EPILOGUE; (* Nouvelle adresse *)
  
  PROLOGUE;
  
  Repeat
    Delay(500);
    Write('.');
    If KeyPressed Then If ReadKEY = Chr(27) Then HALT;
  Until False;

End.  (* SE_HALT *)
