agpl_1.0.0_b5da3320/src/agpl-calendar-serializable_time.ads

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 

with Ada.Calendar;
with Ada.Streams;

--  A Time can't be streamed to remote machines. This is an extension of
--  regular timestamps that replaces 'Read and 'Write with proper
--  serialization subprograms.

package Agpl.Calendar.Serializable_Time is

   --   pragma Elaborate_Body;

   type Object is new Ada.Calendar.Time;

   function "+" (This : in Object) return Ada.Calendar.Time;
   pragma Inline ("+");

   function "+" (This : in Ada.Calendar.Time) return Object;
   pragma Inline ("+");

   procedure Read (Stream : access Ada.Streams.Root_Stream_Type'Class;
                   This   :    out Object);
   for Object'Read use Read;

   procedure Write (Stream : access Ada.Streams.Root_Stream_Type'Class;
                    This   : in     Object);
   for Object'Write use Write;

private

   use Ada.Calendar;

   Epoch : constant Object := Time_Of (1970, 1, 1, 0.0);

end Agpl.Calendar.Serializable_Time;