blob: 5cfa963d5daea7ed2a18b00e087de56d6a2488b0 [file] [log] [blame]
Nico Huber5e9b1b52016-10-08 22:09:33 +02001--
2-- Copyright (C) 2015-2016 secunet Security Networks AG
3--
4-- This program is free software; you can redistribute it and/or modify
5-- it under the terms of the GNU General Public License as published by
Nico Huberaab715f2016-10-18 00:22:25 +02006-- the Free Software Foundation; either version 2 of the License, or
7-- (at your option) any later version.
Nico Huber5e9b1b52016-10-08 22:09:33 +02008--
9-- This program is distributed in the hope that it will be useful,
10-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-- GNU General Public License for more details.
13--
14
15package HW.Time
16 with Abstract_State => (State with External => Async_Writers)
17is
18
19 type T is private;
20
Adrian-Ken Rueegsegger9f87a102017-10-18 14:53:35 +020021 T_First : constant T;
22
Nico Huber5e9b1b52016-10-08 22:09:33 +020023 function Now return T
24 with
25 Volatile_Function,
26 Global => (Input => State);
27
28 function US_From_Now (US : Natural) return T
29 with
30 Volatile_Function,
31 Global => (Input => State);
32
33 function MS_From_Now (MS : Natural) return T
34 with
35 Volatile_Function,
36 Global => (Input => State);
37
38 function Now_US return Int64
39 with
40 Volatile_Function,
41 Global => (Input => State);
42
43 ----------------------------------------------------------------------------
44
45 pragma Warnings
46 (GNATprove, Off, "subprogram ""*Delay*"" has no effect",
47 Reason => "No effect on dataflow but time always passes.");
48
49 -- Delay execution until Deadline has been reached.
50 procedure Delay_Until (Deadline : T)
51 with
52 Global => (Input => State);
53
54 procedure U_Delay (US : Natural)
55 with
56 Global => (Input => State);
57
58 procedure M_Delay (MS : Natural)
59 with
60 Global => (Input => State);
61
62 pragma Warnings
63 (GNATprove, On, "subprogram ""*Delay*"" has no effect");
64
65 ----------------------------------------------------------------------------
66
67 function Timed_Out (Deadline : T) return Boolean
68 with
69 Volatile_Function,
70 Global => (Input => State);
71
72private
73
74 type T is new Word64;
75
Adrian-Ken Rueegsegger9f87a102017-10-18 14:53:35 +020076 T_First : constant T := T'First;
77
Nico Huber5e9b1b52016-10-08 22:09:33 +020078end HW.Time;
79
80-- vim: set ts=8 sts=3 sw=3 et: