| Nico Huber | 5e9b1b5 | 2016-10-08 22:09:33 +0200 | [diff] [blame] | 1 | -- |
| 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 Huber | aab715f | 2016-10-18 00:22:25 +0200 | [diff] [blame^] | 6 | -- the Free Software Foundation; either version 2 of the License, or |
| 7 | -- (at your option) any later version. |
| Nico Huber | 5e9b1b5 | 2016-10-08 22:09:33 +0200 | [diff] [blame] | 8 | -- |
| 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 | |
| 15 | package HW.Time |
| 16 | with Abstract_State => (State with External => Async_Writers) |
| 17 | is |
| 18 | |
| 19 | type T is private; |
| 20 | |
| 21 | function Now return T |
| 22 | with |
| 23 | Volatile_Function, |
| 24 | Global => (Input => State); |
| 25 | |
| 26 | function US_From_Now (US : Natural) return T |
| 27 | with |
| 28 | Volatile_Function, |
| 29 | Global => (Input => State); |
| 30 | |
| 31 | function MS_From_Now (MS : Natural) return T |
| 32 | with |
| 33 | Volatile_Function, |
| 34 | Global => (Input => State); |
| 35 | |
| 36 | function Now_US return Int64 |
| 37 | with |
| 38 | Volatile_Function, |
| 39 | Global => (Input => State); |
| 40 | |
| 41 | ---------------------------------------------------------------------------- |
| 42 | |
| 43 | pragma Warnings |
| 44 | (GNATprove, Off, "subprogram ""*Delay*"" has no effect", |
| 45 | Reason => "No effect on dataflow but time always passes."); |
| 46 | |
| 47 | -- Delay execution until Deadline has been reached. |
| 48 | procedure Delay_Until (Deadline : T) |
| 49 | with |
| 50 | Global => (Input => State); |
| 51 | |
| 52 | procedure U_Delay (US : Natural) |
| 53 | with |
| 54 | Global => (Input => State); |
| 55 | |
| 56 | procedure M_Delay (MS : Natural) |
| 57 | with |
| 58 | Global => (Input => State); |
| 59 | |
| 60 | pragma Warnings |
| 61 | (GNATprove, On, "subprogram ""*Delay*"" has no effect"); |
| 62 | |
| 63 | ---------------------------------------------------------------------------- |
| 64 | |
| 65 | function Timed_Out (Deadline : T) return Boolean |
| 66 | with |
| 67 | Volatile_Function, |
| 68 | Global => (Input => State); |
| 69 | |
| 70 | private |
| 71 | |
| 72 | type T is new Word64; |
| 73 | |
| 74 | end HW.Time; |
| 75 | |
| 76 | -- vim: set ts=8 sts=3 sw=3 et: |