https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119701

--- Comment #2 from William Rupert Greene <wrg at acm dot org> ---
Following your suggestions, here is the changed Ada program:
   with Ada.Calendar;                 -- (RM 9.6)
   with Ada.Calendar.Arithmetic;      -- (RM 9.6.1)
   with Ada.Calendar.Formatting;      -- (RM 9.6.1)
   with Ada.Calendar.Time_Zones;      -- (RM 9.6.1)
   with Ada.Text_IO; use Ada.Text_IO; -- (RM A.10.1)
   procedure Show_Error is
      package AC  renames Ada.Calendar;
      package ACA renames Ada.Calendar.Arithmetic;
      package ACF renames Ada.Calendar.Formatting;
      package ACZ renames Ada.Calendar.Time_Zones;
      TZ : constant ACZ.Time_Offset := ACZ.Time_Offset (-5 * 60);
      T1 : constant AC.Time         := ACF.Time_Of (2025, 11, 2, Time_Zone =>
TZ);
      T2 : constant AC.Time         := ACA."+" (T1, 1);
   begin
      Put_Line ("T1 = " & ACF.Image (T1, Time_Zone => TZ) &
                ", Ada.Calendar.Formatting.Day_Of_Week (T1) = " &
                ACF.Day_Of_Week (T1)'Image);
      Put_Line ("T2 = " & ACF.Image (T2, Time_Zone => TZ) &
                ", Ada.Calendar.Formatting.Day_Of_Week (T2) = " &
                ACF.Day_Of_Week (T2)'Image);
   end Show_Error;

Program, when run, now produces this output, which is correct:
   T1 = 2025-11-02 00:00:00, Ada.Calendar.Formatting.Day_Of_Week (T1) = SUNDAY
   T2 = 2025-11-03 00:00:00, Ada.Calendar.Formatting.Day_Of_Week (T2) = MONDAY

Reply via email to