BenoƮt Ganne | 56eccdb | 2021-08-20 09:18:31 +0200 | [diff] [blame] | 1 | /* |
| 2 | * SPDX-License-Identifier: Apache-2.0 |
| 3 | * Copyright(c) 2021 Cisco Systems, Inc. |
| 4 | */ |
| 5 | |
| 6 | #ifndef included_vlib_time_h |
| 7 | #define included_vlib_time_h |
| 8 | |
| 9 | #include <vlib/vlib.h> |
| 10 | #include <vppinfra/tw_timer_1t_3w_1024sl_ov.h> |
| 11 | |
| 12 | static inline f64 |
| 13 | vlib_time_get_next_timer (vlib_main_t *vm) |
| 14 | { |
| 15 | vlib_node_main_t *nm = &vm->node_main; |
| 16 | TWT (tw_timer_wheel) *wheel = nm->timing_wheel; |
| 17 | return TW (tw_timer_first_expires_in_ticks) (wheel) * wheel->timer_interval; |
| 18 | } |
| 19 | |
| 20 | static inline void |
| 21 | vlib_time_adjust (vlib_main_t *vm, f64 offset) |
| 22 | { |
| 23 | vm->time_offset += offset; |
| 24 | } |
| 25 | |
| 26 | #endif /* included_vlib_time_h */ |