with Ada.Calendar; use Ada.Calendar; with Ada.Strings; use Ada.Strings; with Ada.Strings.Fixed; use Ada.Strings.Fixed; package body Simple_Time is function To_String (Moment : in Time) return String is Raw_Secs : Day_Duration := Seconds (Moment); Hours : Integer := Integer (Raw_Secs) / 3600; Minutes : Integer := (Integer (Raw_Secs) - Hours * 3600) / 60; Seconds : Duration := Raw_Secs - Duration (Hours) * 3600 - Duration (Minutes) * 60; begin return Trim (Year_Number'Image (Year (Moment)), Both) & "-" & Trim (Month_Number'Image (Month (Moment)), Both) & "-" & Trim (Day_Number'Image (Day (Moment)), Both) & " " & Trim (Integer'Image (Hours), Both) & ":" & Trim (Integer'Image (Minutes), Both) & ":" & Trim (Duration'Image (Seconds), Both); end To_String; end Simple_Time;