From: Natasha Kerensikova <lithiumcat@instinctive.eu>
Subject: Leap second support and ARM 9.6.1p89/2
Date: Tue, 5 Aug 2014 19:47:43 +0000 (UTC)
Date: 2014-08-05T19:47:43+00:00 [thread overview]
Message-ID: <slrnlu2d6u.nrc.lithiumcat@nat.rebma.instinctive.eu> (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
next reply other threads:[~2014-08-05 19:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-05 19:47 Natasha Kerensikova [this message]
2014-08-07 4:57 ` Leap second support and ARM 9.6.1p89/2 Randy Brukardt
2014-08-07 7:35 ` Natasha Kerensikova
2014-08-07 8:59 ` Markus Schöpflin
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox