27#if defined(PEBL_WIN32) || defined(PEBL_WINDOWS)
34#include "../../devices/DeviceState.h"
37#include <emscripten.h>
41#if defined(PEBL_UNIX) || defined(PEBL_EMSCRIPTEN)
45#elif defined(PEBL_WIN32) || defined(PEBL_WINDOWS)
83 unsigned long int timeX = SDL_GetTicks() + msecs;
84 unsigned long int missedticks = 0;
85 unsigned long int missedms = 0;
86 unsigned long int lasttime = 0;
88 unsigned long int time=SDL_GetTicks();
94 time = SDL_GetTicks();
95 if((time-lasttime) > 1)
98 missedms += (time-lasttime);
105 cerr <<
"Timer missed [" << missedticks <<
"] ticks, for a total of [" << missedms <<
"] ms, on a wait of [" << msecs <<
"] ms.\n";
115 unsigned long int timeX = SDL_GetTicks() + msecs;
116 unsigned long int time;
120 time = SDL_GetTicks();
134#ifdef PEBL_EMSCRIPTEN
136 emscripten_sleep(msecs);
137#elif defined(PEBL_UNIX)
139 struct timespec a, b;
140 a.tv_sec = msecs / 1000;
141 a.tv_nsec = (msecs % 1000) * 1000000;
143#elif defined(PEBL_WIN32) || defined(PEBL_WINDOWS)
155 return SDL_GetTicks();
161 return SDL_GetTicks();
173#if defined( PEBL_UNIX) || defined(PEBL_EMSCRIPTEN)
174 struct timeval * tp=
NULL;
175 gettimeofday(tp,
NULL);
177 time_t secs1 = tp->tv_sec;
178 suseconds_t usecs = tp->tv_usec;
185 ::GetSystemTime(&st);
188 std::cerr << std::setw(2) << st.wHour <<
':'
189 << std::setw(2) << st.wMinute <<
':'
190 << std::setw(2) << st.wSecond <<
'.'
191 << std::setw(3) << st.wMilliseconds <<
'\n';
198ostream & PlatformTimer::SendToStream(ostream & out)
const
200 out <<
"<SDL Platform Timer>" << std::flush;