#include <ctime>
#include <stdexcept>
+#include "Log.hh"
#include "Timer.hh"
#if HAVE_CONFIG_H
#include "config.h"
#endif
+#include <SDL/SDL.h>
+
namespace Mf {
// SDL only promises centisecond accuracy, but that's better than a kick in the
// butt.
-#include <SDL/SDL.h>
-
Scalar getTicks()
{
Uint32 ms = SDL_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