From 196f41688d01b7f0a79567c617fd6dd3171150ff Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Mon, 21 Jan 2013 03:29:17 +0100 Subject: menu/timer: use base/timestamp --- src/menu/timer.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/menu/timer.cpp') diff --git a/src/menu/timer.cpp b/src/menu/timer.cpp index 24da0c68..d091aed5 100644 --- a/src/menu/timer.cpp +++ b/src/menu/timer.cpp @@ -23,12 +23,11 @@ */ #include "timer.hpp" -#include namespace usdx { - Timer::Timer(Control* owner, uint32_t duration, bool init) : - Control(owner), duration(duration), last_update(0), ready(init) + Timer::Timer(Control* owner, float duration, bool init) : + Control(owner), duration(duration), ready(init), last_update() { } @@ -36,15 +35,10 @@ namespace usdx { } - uint32_t Timer::now(void) const - { - return SDL_GetTicks(); - } - void Timer::update(void) { ready = false; - last_update = now(); + last_update.update(); } bool Timer::is_ready(void) @@ -52,7 +46,7 @@ namespace usdx if (ready) return true; - if ((now() - last_update) > duration) + if (!last_update.since(duration)) { ready = true; return true; -- cgit v1.2.3