diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-06-01 12:33:20 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-12-07 13:49:27 +0100 |
commit | 025525266f6861437ca54aca2a86eb505a486baf (patch) | |
tree | 8a4f2035ef7edbcd77224ed76598ec0806f24512 /lib/timer.h | |
parent | 28a7d3943ef915c405b3552ae06f639a86f4dc1e (diff) |
Timers: Replace old timers with microsecond timers
The old timer interface is still kept, but implemented by new timers. The
plan is to switch from the old inteface to the new interface, then clean
it up.
Diffstat (limited to 'lib/timer.h')
-rw-r--r-- | lib/timer.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/timer.h b/lib/timer.h index 88c53547..b70ac48d 100644 --- a/lib/timer.h +++ b/lib/timer.h @@ -44,6 +44,11 @@ static inline timer2 *timers_first(struct timeloop *loop) extern struct timeloop main_timeloop; btime current_time(void); +btime current_real_time(void); + +#define now (current_time() TO_S) +#define now_real (current_real_time() TO_S) +extern btime boot_time; timer2 *tm2_new(pool *p); void tm2_set(timer2 *t, btime when); @@ -59,8 +64,8 @@ tm2_active(timer2 *t) static inline btime tm2_remains(timer2 *t) { - btime now = current_time(); - return (t->expires > now) ? (t->expires - now) : 0; + btime now_ = current_time(); + return (t->expires > now_) ? (t->expires - now_) : 0; } static inline timer2 * @@ -81,18 +86,17 @@ tm2_set_max(timer2 *t, btime when) tm2_set(t, when); } -/* static inline void tm2_start_max(timer2 *t, btime after) { btime rem = tm2_remains(t); tm2_start(t, MAX_(rem, after)); } -*/ /* In sysdep code */ void times_init(struct timeloop *loop); void times_update(struct timeloop *loop); +void times_update_real_time(struct timeloop *loop); /* For I/O loop */ void timers_init(struct timeloop *loop, pool *p); |