File: /home/oboss/Users/gec/sources/Basic_Services/Low_Level_Stuff/system_clock.ads

1     --% Compilation Unit:	System_Clock
2     --
3     --% Category: Package Declaration
4     --
5     --% Release:  $Name:  $
6     --
7     --% Version:  $Revision: 2.0 $
8     --
9     --% Author:   $Author: gec $
10     --
11     --% Revision Log:
12     --    $Log: system_clock.ads,v $
13     --    Revision 2.0  2003/04/04 08:50:07  gec
14     --    Initial release of source files serving as baseline for OBOSS-III project.
15     --
16     --    Revision 1.1.1.1  2003/04/04 08:13:03  gec
17     --    Imported using TkCVS
18     --
19     --
20     --
21     --% Project: OBOSS
22     --
23     --% Copyright (C) 2003 by Terma A/S
24     --  Proprietary and intellectual rights of Terma A/S, Denmark,
25     --  are involved in the subject-matter of this material and
26     --  all manufacturing, reproduction, use, disclosure, and
27     --  sales rights pertaining to such subject-matter are
28     --  expressly reserved. This material is submitted for a
29     --  specific purpose as agreed, and the recipient by
30     --  accepting this material agrees that this material will
31     --  not be used, copied, or reproduced in whole or in part
32     --  nor its contents revealed in any manner or to any person,
33     --  except to meet the purpose for which it was submitted and
34     --  subject to the terms of the agreement.
35     --
36     --% Target Dependencies:
37     --    None
38     --% Compiler Dependencies:
39     --    None
40     
41     --~-----------------------------------------------------------------------------
42     
43     with Ada.Real_Time;
44     package System_Clock is
45     
46        --% Library Package:
47        --    Definition of basic types and operations related to time
48        --% Active Tasks:
49        -->   None
50        --% Passive Tasks:
51        -->   None
52     
53        --% Subprogram:
54        --    Get the current system time.
55        --% Parameter Constraints:
56        -->   None
57        --% Exceptions Raised:
58        -->   None
59     
60        function Clock
61              return Ada.Real_Time.Time renames Ada.Real_Time.Clock;
62     
63        -- Global start time relative to which all periodic events in system will be
64        --+    scheduled.
65        System_Start_Time : constant Ada.Real_Time.Time := Clock;
66     
67     
68        -- To wait for all tasks to be elaborated and activate them at the same time.
69        Task_Activation_Delay : constant Ada.Real_Time.Time_Span
70     	 := Ada.Real_Time.Milliseconds (463);
71     
72     
73        --% Subprogram:
74        --    Convert from Standard.Duration to Ada.Real_Time.Time_Span.
75        --% Parameter Constraints:
76        -->   None
77        --% Exceptions Raised:
78        -->   None
79     
80        --  Raven compiler does not support this function. Rodrigo 15/8/2000.
81     
82     --   function To_Time_Span
83     --         (D :        Duration)
84     --         return Ada.Real_Time.Time_Span renames Ada.Real_Time.To_Time_Span;
85     
86     
87        --% Subprogram:
88        --    Temporal ordering: T1 < T2 iff T1 is earlier than T2.
89        --% Parameter Constraints:
90        -->   None
91        --% Exceptions Raised:
92        -->   None
93     
94        function "<"
95              (T1, T2 :        Ada.Real_Time.Time)
96              return Boolean renames Ada.Real_Time."<";
97     
98     
99        --% Subprogram:
100        --    Time after interval: T + I corresponds to time I after T.
101        --% Parameter Constraints:
102        -->   None
103        --% Exceptions Raised:
104        -->   None
105     
106        function "+"
107              (T :        Ada.Real_Time.Time;
108               I :        Ada.Real_Time.Time_Span)
109              return Ada.Real_Time.Time renames Ada.Real_Time."+";
110     
111     
112        --% Subprogram:
113        --    Interval between: T2 - T1 is the interval from T1 to T2.
114        --% Parameter Constraints:
115        -->   None
116        --% Exceptions Raised:
117        -->   None
118     
119        function "-"
120              (T2, T1 :        Ada.Real_Time.Time)
121              return Ada.Real_Time.Time_Span renames Ada.Real_Time."-";
122     
123     
124        --% Subprogram:
125        --    Time before interval: Time corresponding to I earlier than T.
126        --% Parameter Constraints:
127        -->   None
128        --% Exceptions Raised:
129        -->   None
130     
131        function "-"
132              (T :        Ada.Real_Time.Time;
133               I :        Ada.Real_Time.Time_Span)
134              return Ada.Real_Time.Time renames Ada.Real_Time."-";
135     
136        --% Subprogram:
137        --    Transform an integral number of microseconds to an interval.
138        --% Parameter Constraints:
139        -->   None
140        --% Exceptions Raised:
141        -->   None
142     
143        function Microseconds
144              (Us :        Integer)
145              return Ada.Real_Time.Time_Span renames Ada.Real_Time.Microseconds;
146     
147     
148        --% Subprogram:
149        --    Transform an integral number of milliseconds to an interval.
150        --% Parameter Constraints:
151        -->   None
152        --% Exceptions Raised:
153        -->   None
154     
155        function Milliseconds
156              (Ms :        Integer)
157              return Ada.Real_Time.Time_Span renames Ada.Real_Time.Milliseconds;
158     
159     end System_Clock;
160     
161     --~-----------------------------------------------------------------------------
162