diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2013-04-17 13:22:58 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2013-04-27 14:09:22 -0700 |
commit | d18f5bdb682a1d9c6e3a191926bfd46d36e813c1 (patch) | |
tree | c987d53ea924b761e5445572a438e0c4bc825d48 /src/common/timer.hpp | |
parent | da6b990ca1f553a017003f32a436304c66c62b9e (diff) | |
download | tmwa-d18f5bdb682a1d9c6e3a191926bfd46d36e813c1.tar.gz tmwa-d18f5bdb682a1d9c6e3a191926bfd46d36e813c1.tar.bz2 tmwa-d18f5bdb682a1d9c6e3a191926bfd46d36e813c1.tar.xz tmwa-d18f5bdb682a1d9c6e3a191926bfd46d36e813c1.zip |
Force timers to be managed
Diffstat (limited to 'src/common/timer.hpp')
-rw-r--r-- | src/common/timer.hpp | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/src/common/timer.hpp b/src/common/timer.hpp index 876d519..c581377 100644 --- a/src/common/timer.hpp +++ b/src/common/timer.hpp @@ -5,12 +5,6 @@ # include "sanity.hpp" -# include <chrono> -# include <functional> - -/// (to get additional arguments, use std::bind or a lambda). -typedef std::function<void (TimerData *, tick_t)> timer_func; - // updated automatically when using milli_clock::now() // which is done only by core.cpp extern tick_t gettick_cache; @@ -21,23 +15,8 @@ tick_t gettick(void) return gettick_cache; } -/// Schedule a one-shot timer at the given tick. -/// The timer will automatically be freed after it is called -/// (during a do_timer). -TimerData *add_timer(tick_t t, timer_func f); - -/// Schedule a recurring timer initially at the given tick. -/// The timer will automatically reregister itself, with the same -/// opaque handle, every interval after the tick. -/// It will never be freed unless you use delete_timer. -TimerData *add_timer_interval(tick_t, timer_func, interval_t); - -/// Cancel the given timer. -/// This doesn't actually remove it, it just resets the functor. -/// and waits for the the tick to arrive in do_timer. -void delete_timer(TimerData *); - -/// Do all timers scheduled before tick, and return the number of milliseconds until the next timer happens +/// Do all timers scheduled before tick, and return the number of +/// milliseconds until the next timer happens interval_t do_timer(tick_t tick); /// Stat a file, and return its modification time, truncated to seconds. |