The new routines convert back and forth between private type OS_Time and
a long integer which can be used in package Ada.Calendar.Conversions
routines to convert to Ada.Calendar.Time.
2019-08-19 Dmitriy Anisimkov <anisimko@adacore.com>
gcc/ada/
* libgnat/s-os_lib.ads, libgnat/s-os_lib.adb (To_Ada, To_C): New
routines.
From-SVN: r274661
+2019-08-19 Dmitriy Anisimkov <anisimko@adacore.com>
+
+ * libgnat/s-os_lib.ads, libgnat/s-os_lib.adb (To_Ada, To_C): New
+ routines.
+
2019-08-19 Bob Duff <duff@adacore.com>
* exp_attr.adb (Attribute_Valid): Correct the handling of
end loop;
end Spawn_Internal;
+ ------------
+ -- To_Ada --
+ ------------
+
+ function To_Ada (Time : time_t) return OS_Time is
+ begin
+ return OS_Time (Time);
+ end To_Ada;
+
---------------------------
-- To_Path_String_Access --
---------------------------
return Return_Val;
end To_Path_String_Access;
+ ----------
+ -- To_C --
+ ----------
+
+ function To_C (Time : OS_Time) return time_t is
+ begin
+ return time_t (Time);
+ end To_C;
+
------------------
-- Wait_Process --
------------------
-- component parts to be interpreted in the local time zone, and returns
-- an OS_Time. Returns Invalid_Time if the creation fails.
+ subtype time_t is Long_Integer;
+ -- C time_t type of the time representation
+
+ function To_C (Time : OS_Time) return time_t;
+ -- Convert OS_Time to C time_t type
+
+ function To_Ada (Time : time_t) return OS_Time;
+ -- Convert C time_t type to OS_Time
+
----------------
-- File Stuff --
----------------
pragma Inline (">");
pragma Inline ("<=");
pragma Inline (">=");
+ pragma Inline (To_C);
+ pragma Inline (To_Ada);
type Process_Id is new Integer;
Invalid_Pid : constant Process_Id := -1;