X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FTimer.cc;h=bc7aae220416687747de6f29bf07c39fc39a3f67;hp=fb17f1d66e1ac3a89c99c95a4cec94d9412c0dde;hb=57b78ebe21b1b48acd337daa5a1cb8c383959cfa;hpb=58cedf00e6ebf6282938c019b8eb105e3fb05eaa diff --git a/src/Moof/Timer.cc b/src/Moof/Timer.cc index fb17f1d..bc7aae2 100644 --- a/src/Moof/Timer.cc +++ b/src/Moof/Timer.cc @@ -30,12 +30,15 @@ #include #include +#include "Log.hh" #include "Timer.hh" #if HAVE_CONFIG_H #include "config.h" #endif +#include + namespace Mf { @@ -100,8 +103,6 @@ void sleep(Scalar seconds, bool absolute) // SDL only promises centisecond accuracy, but that's better than a kick in the // butt. -#include - Scalar getTicks() { Uint32 ms = SDL_GetTicks(); @@ -111,8 +112,7 @@ Scalar getTicks() void sleep(Scalar seconds, bool absolute) { if (absolute) seconds -= getTicks(); - - SDL_Delay(Uint32(seconds * 1000.0)); + SDL_Delay(Uint32(cml::clamp(int(seconds * 1000.0), 0, 1000))); } #endif // HAVE_CLOCK_GETTIME