comp.lang.ada
 help / color / mirror / Atom feed
* Leap second support and ARM 9.6.1p89/2
@ 2014-08-05 19:47 Natasha Kerensikova
  2014-08-07  4:57 ` Randy Brukardt
  0 siblings, 1 reply; 4+ messages in thread
From: Natasha Kerensikova @ 2014-08-05 19:47 UTC (permalink / raw)


Hello,

I've recently came across ARM 9.6.1p89/2 and tried the following
function to detect leap second at runtime:

   function Leap_Second_Support return Boolean is
      use Ada.Calendar;
      use Ada.Calendar.Time;

      Date : Time;
   begin
      begin
         Date := Time_Of
           (Year => 1990,
            Month => 12,
            Day => 31,
            Hour => 23,
            Minute => 59,
            Second => 59,
            Sub_Second => 0.5,
            Leap_Second => True,
            Time_Zone => 0);
      exception
         when Time_Error =>
            return False;
      end;

      declare
         Year : Year_Number;
         Month : Month_Number;
         Day : Day_Number;
         Hour : Hour_Number;
         Minute : Minute_Number;
         Second : Second_Number;
         Sub_Second : Second_Duration;
         Leap_Second : Boolean;
      begin
         Split
           (Date,
            Year, Month, Day,
            Hour, Minute, Second, Sub_Second,
            Leap_Second, 0);

         pragma Assert (Year = 1990);
         pragma Assert (Month = 12);
         pragma Assert (Day = 31);
         pragma Assert (Hour = 23);
         pragma Assert (Minute = 59);
         pragma Assert (Second = 59);
         pragma Assert (Leap_Second);
      end;

      return True;
   end Leap_Second_Support;

I was quite surprised to find that on my platforms (FSF GNAT 4.9.0 on
FreeBSD and FSF GNAT 4.8.3 on Fedora), the assertion testing Leap_Second
is raised, which means that Leap_Second is ignored instead of raising an
exception.

I realize that 9.6.1p89/2 is under "Implementation Advice", so I guess
that ignoring Leap_Second is allowed by the standard, right?
Should I still report it as a bug somewhere?

Can I just replace "pragma Assert (Leap_Second)" with "return False;" or
is it even more subtle? I don't see anything about the semantics for
systems without support for leap seconds, does it means it's undefined
behavior?


Thanks for your insights,
Natasha


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-07  8:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-05 19:47 Leap second support and ARM 9.6.1p89/2 Natasha Kerensikova
2014-08-07  4:57 ` Randy Brukardt
2014-08-07  7:35   ` Natasha Kerensikova
2014-08-07  8:59     ` Markus Schöpflin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox