gcc/
[official-gcc.git] / gcc / ada / s-osprim-vms.ads
blob3b4ed328c8e1fa7de1a131caf4e451644e88253c
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
4 -- --
5 -- S Y S T E M . O S _ P R I M I T I V E S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1998-2009, Free Software Foundation, Inc. --
10 -- --
11 -- GNARL is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNARL was developed by the GNARL team at Florida State University. --
28 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
29 -- --
30 ------------------------------------------------------------------------------
32 -- This package provides low level primitives used to implement clock and
33 -- delays in non tasking applications on Alpha/VMS.
35 -- The choice of the real clock/delay implementation (depending on whether
36 -- tasking is involved or not) is done via soft links (see s-soflin.ads)
38 -- NEVER add any dependency to tasking packages here
40 package System.OS_Primitives is
41 pragma Preelaborate;
43 subtype OS_Time is Long_Integer;
44 -- System time on VMS is used for performance reasons.
45 -- Note that OS_Time is *not* the same as Ada.Calendar.Time, the
46 -- difference being that relative OS_Time is negative, but relative
47 -- Calendar.Time is positive.
48 -- See Ada.Calendar.Delays for more information on VMS Time.
50 Max_Sensible_Delay : constant Duration :=
51 Duration'Min (183 * 24 * 60 * 60.0,
52 Duration'Last);
53 -- Max of half a year delay, needed to prevent exceptions for large delay
54 -- values. It seems unlikely that any test will notice this restriction,
55 -- except in the case of applications setting the clock at run time (see
56 -- s-tastim.adb). Also note that a larger value might cause problems (e.g
57 -- overflow, or more likely OS limitation in the primitives used). In the
58 -- case where half a year is too long (which occurs in high integrity mode
59 -- with 32-bit words, and possibly on some specific ports of GNAT),
60 -- Duration'Last is used instead.
62 procedure Initialize;
63 -- Initialize global settings related to this package. This procedure
64 -- should be called before any other subprograms in this package. Note
65 -- that this procedure can be called several times.
67 function OS_Clock return OS_Time;
68 -- Returns "absolute" time, represented as an offset
69 -- relative to "the Epoch", which is Nov 17, 1858 on VMS.
71 function Clock return Duration;
72 pragma Inline (Clock);
73 -- Returns "absolute" time, represented as an offset relative to "the
74 -- Epoch", which is Jan 1, 1970 00:00:00 UTC on UNIX systems. This
75 -- implementation is affected by system's clock changes.
77 function Monotonic_Clock return Duration;
78 pragma Inline (Monotonic_Clock);
79 -- Returns "absolute" time, represented as an offset relative to "the Unix
80 -- Epoch", which is Jan 1, 1970 00:00:00 UTC. This clock implementation is
81 -- immune to the system's clock changes.
83 Relative : constant := 0;
84 Absolute_Calendar : constant := 1;
85 Absolute_RT : constant := 2;
86 -- Values for Mode call below. Note that the compiler (exp_ch9.adb) relies
87 -- on these values. So any change here must be reflected in corresponding
88 -- changes in the compiler.
90 procedure Timed_Delay (Time : Duration; Mode : Integer);
91 -- Implements the semantics of the delay statement when no tasking is used
92 -- in the application.
94 -- Mode is one of the three values above
96 -- Time is a relative or absolute duration value, depending on Mode.
98 -- Note that currently Ada.Real_Time always uses the tasking run time,
99 -- so this procedure should never be called with Mode set to Absolute_RT.
100 -- This may change in future or bare board implementations.
102 function To_Duration (T : OS_Time; Mode : Integer) return Duration;
103 -- Convert VMS system time to Duration
104 -- Mode is one of the three values above
106 function To_OS_Time (D : Duration; Mode : Integer) return OS_Time;
107 -- Convert Duration to VMS system time
108 -- Mode is one of the three values above
110 end System.OS_Primitives;