PROCEDURE Time;
BEGIN
   { get time from regular system clock and break into hours, minutes and sec.}
   Start := Ticks;               { starting point for second counter }
   Temp_Time := T_Gettime ;               { get system time }
   Sec := ( Temp_Time & 31 );             { Seconds * 2 }
   Sec := Sec * 2 ;
   Min := SHR( ( Temp_Time & 2016 ),5 );  { Minutes }
   Hr  := SHR( Temp_Time,11 );{ Hours - military }
   Hr  := Hr & 31 ;
          { calculate total seconds from midnight on system clock }
   Total_Sec := 0 ;
   Temp_Sec := Hr ;
   Temp_Sec := ( Temp_Sec*3600 );
   Total_Sec := Temp_Sec ;
   Temp_Sec := Min ;
   Temp_Sec := ( Temp_Sec*60 ) ;
   Total_Sec := Total_Sec + Temp_Sec ;
   Temp_Sec := Sec ;
   Total_Sec := Total_Sec + Temp_Sec ;
   Temp_Sec := Total_Sec ;
   Original_Sec := Total_Sec ;
      { calculate which digits to print for Draw_String comand }
   PM_Flag := False ;
   IF Hr > 12 THEN
   BEGIN
      Hr := Hr-12 ;
      PM_Flag := True;
   END;
   IF Hr = 0 THEN Hr := 12 ;
   Hr_10 :=  Hr DIV 10 ;
   Hr_1 :=  Hr MOD 10 ;
   IF Sec = 0 THEN
   BEGIN
      Sec_1 := 0;
      Sec_10 := 0;
   END
   ELSE BEGIN
      Sec_10 :=  Sec DIV 10 ;
      Sec_1 :=  Sec MOD 10 ;
   END;
   IF Min = 0 THEN
   BEGIN
      Min_1 := 0;
      Min_10 := 0;
   END
   ELSE BEGIN
      Min_10 := Min DIV 10 ;
      Min_1 := Min MOD 10 ;
   END;
      Hide_Mouse ;
      Text_Color( 2 );
      Draw_String( 16,30,'  HOUR       MINUTE        SECOND  ' ) ;
      D_Hr_10 ;                    {  Draw Digit on the screen }
      DX := 36 ;
      D_Digit( Hr_1 ) ;
      DX := 100 ;
      D_Digit( Min_10 ) ;
      DX := 148 ;
      D_Digit( Min_1 ) ;
      DX := 212 ;
      D_Digit( Sec_10 ) ;
      DX := 260 ;
      D_Digit( Sec_1 ) ;
      Text_Color( 2 );
      IF PM_Flag THEN Draw_String( 272,119,'PM' )
                 ELSE Draw_String( 272,119,'AM' );
      Old_Hr_10:=Hr_10; Old_Hr_1:=Hr_1;
      Old_Min_10:=Min_10; Old_Min_1:=Min_1;
      Old_Sec_10:=Sec_10; Old_Sec_1:=Sec_1;
      Show_Mouse ;
END;  { of Time }
