-- cal.adb -------------------------------------------------------- -- Program to display current Date and Time -- -------------------------------------------------------- with Ada.Calendar; use Ada.Calendar; with Ada.Text_IO; use Ada.Text_IO; procedure Cal is package Int_IO is new Ada.Text_IO.Integer_IO(Integer); Epoch : Time; Temp : Integer; Hour : Integer; Minute : Integer; Second : Integer; begin Epoch := Clock; -- call the function Clock in package Ada.Calendar Int_IO.Put(Month(Epoch),0); -- Month is a function to extract month number Put('/'); Int_IO.Put(Day(Epoch),0); -- Day is function to extract day number Put('/'); Int_IO.Put(Year(Epoch),0); -- Year is function to extract year number Put(' '); Temp := Integer(Seconds(Epoch)); -- Seconds is function to extract Hour := Temp / 3600; -- seconds since midnight of type duration Int_IO.Put(Hour,0); Put(':'); Minute := (Temp / 60) mod 60; Int_IO.Put(Minute,0); Put(':'); Second := Temp mod 60; Int_IO.Put(Second,0); New_Line; end Cal;