1-- { dg-do compile } 2-- { dg-options "-Os -g" } 3 4with Opt7_Pkg; 5 6package body Opt7 is 7 8 procedure Parse (Str : String; 9 Time_Type : out time_t; 10 Abs_Time : out Time; 11 Delt_Time : out Duration) is 12 Year : Year_Number; 13 Month : Month_Number; 14 Day : Day_Number; 15 Minute : Integer := 0; 16 Idx : Integer := Str'First; 17 Ch : Character := Str (Idx); 18 Current_Time : Time; 19 20 begin 21 if Ch = '-' then 22 Time_Type := Absolute_Time; 23 Current_Time := Clock; 24 Day := Ada.Calendar.Day (Current_Time); 25 Month := Ada.Calendar.Month (Current_Time); 26 Year := Ada.Calendar.Year (Current_Time); 27 else 28 Time_Type := Delta_Time; 29 end if; 30 while Ch in '0' .. '9' loop 31 Minute := Minute + Character'Pos (Ch); 32 Idx := Idx + 1; 33 Ch := Str (Idx); 34 end loop; 35 if Time_Type = Absolute_Time then 36 Abs_Time := Time_Of (Year, Month, Day, Day_Duration (1)); 37 else 38 Delt_Time := Duration (Float (Minute)); 39 end if; 40 exception 41 when others => Opt7_Pkg.My_Raise_Exception; 42 end; 43 44end Opt7; 45