| 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 |
| 6 | -- the Free Software Foundation; version 2 of the License. |
| 7 | -- |
| 8 | -- This program is distributed in the hope that it will be useful, |
| 9 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | -- GNU General Public License for more details. |
| 12 | -- |
| 13 | |
| 14 | package HW.Time |
| 15 | with Abstract_State => (State with External => Async_Writers) |
| 16 | is |
| 17 | |
| 18 | type T is private; |
| 19 | |
| 20 | function Now return T |
| 21 | with |
| 22 | Volatile_Function, |
| 23 | Global => (Input => State); |
| 24 | |
| 25 | function US_From_Now (US : Natural) return T |
| 26 | with |
| 27 | Volatile_Function, |
| 28 | Global => (Input => State); |
| 29 | |
| 30 | function MS_From_Now (MS : Natural) return T |
| 31 | with |
| 32 | Volatile_Function, |
| 33 | Global => (Input => State); |
| 34 | |
| 35 | function Now_US return Int64 |
| 36 | with |
| 37 | Volatile_Function, |
| 38 | Global => (Input => State); |
| 39 | |
| 40 | ---------------------------------------------------------------------------- |
| 41 | |
| 42 | pragma Warnings |
| 43 | (GNATprove, Off, "subprogram ""*Delay*"" has no effect", |
| 44 | Reason => "No effect on dataflow but time always passes."); |
| 45 | |
| 46 | -- Delay execution until Deadline has been reached. |
| 47 | procedure Delay_Until (Deadline : T) |
| 48 | with |
| 49 | Global => (Input => State); |
| 50 | |
| 51 | procedure U_Delay (US : Natural) |
| 52 | with |
| 53 | Global => (Input => State); |
| 54 | |
| 55 | procedure M_Delay (MS : Natural) |
| 56 | with |
| 57 | Global => (Input => State); |
| 58 | |
| 59 | pragma Warnings |
| 60 | (GNATprove, On, "subprogram ""*Delay*"" has no effect"); |
| 61 | |
| 62 | ---------------------------------------------------------------------------- |
| 63 | |
| 64 | function Timed_Out (Deadline : T) return Boolean |
| 65 | with |
| 66 | Volatile_Function, |
| 67 | Global => (Input => State); |
| 68 | |
| 69 | private |
| 70 | |
| 71 | type T is new Word64; |
| 72 | |
| 73 | end HW.Time; |
| 74 | |
| 75 | -- vim: set ts=8 sts=3 sw=3 et: |