[Ada] Turn Ada.Calendar.Epoch_Offset into a function
authorArnaud Charlet <charlet@adacore.com>
Tue, 29 May 2018 09:41:40 +0000 (09:41 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 29 May 2018 09:41:40 +0000 (09:41 +0000)
2018-05-29  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* libgnat/a-calend.ads, libgnat/a-calend.adb (Epoch_Offset): Make it a
function.

From-SVN: r260878

gcc/ada/ChangeLog
gcc/ada/libgnat/a-calend.adb
gcc/ada/libgnat/a-calend.ads

index be6192d..3eb0a41 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-29  Arnaud Charlet  <charlet@adacore.com>
+
+       * libgnat/a-calend.ads, libgnat/a-calend.adb (Epoch_Offset): Make it a
+       function.
+
 2018-05-29  Olivier Hainque  <hainque@adacore.com>
 
        * libgnat/system-vxworks7-ppc-rtp.ads: New file.
index 8299b74..8bf5e7a 100644 (file)
@@ -500,6 +500,15 @@ is
       return D;
    end Day;
 
+   ------------------
+   -- Epoch_Offset --
+   ------------------
+
+   function Epoch_Offset return Time_Rep is
+   begin
+      return (136 * 365 + 44 * 366) * Nanos_In_Day;
+   end Epoch_Offset;
+
    -------------
    -- Is_Leap --
    -------------
index 4371e11..b124380 100644 (file)
@@ -221,8 +221,9 @@ private
    --  with overloading ambiguities in the body if we tried to use Time as an
    --  internal computational type.
 
-   Epoch_Offset : constant Time_Rep := (136 * 365 + 44 * 366) * Nanos_In_Day;
-   --  The difference between 2150-1-1 UTC and 1970-1-1 UTC expressed in
+   function Epoch_Offset return Time_Rep;
+   pragma Inline (Epoch_Offset);
+   --  Return the difference between 2150-1-1 UTC and 1970-1-1 UTC expressed in
    --  nanoseconds. Note that year 2100 is non-leap.
 
    Days_In_Month : constant array (Month_Number) of Day_Number :=