slouken@0: /* slouken@5535: Simple DirectMedia Layer slouken@10737: Copyright (C) 1997-2017 Sam Lantinga slouken@0: slouken@5535: This software is provided 'as-is', without any express or implied slouken@5535: warranty. In no event will the authors be held liable for any damages slouken@5535: arising from the use of this software. slouken@0: slouken@5535: Permission is granted to anyone to use this software for any purpose, slouken@5535: including commercial applications, and to alter it and redistribute it slouken@5535: freely, subject to the following restrictions: slouken@0: slouken@5535: 1. The origin of this software must not be misrepresented; you must not slouken@5535: claim that you wrote the original software. If you use this software slouken@5535: in a product, an acknowledgment in the product documentation would be slouken@5535: appreciated but is not required. slouken@5535: 2. Altered source versions must be plainly marked as such, and must not be slouken@5535: misrepresented as being the original software. slouken@5535: 3. This notice may not be removed or altered from any source distribution. slouken@0: */ icculus@8093: #include "../../SDL_internal.h" slouken@0: icculus@7981: #ifdef SDL_TIMER_HAIKU slouken@1635: icculus@7981: #include slouken@0: slouken@0: #include "SDL_timer.h" slouken@0: slouken@0: static bigtime_t start; urkle@7649: static SDL_bool ticks_started = SDL_FALSE; slouken@0: slouken@1895: void slouken@8268: SDL_TicksInit(void) slouken@0: { urkle@7649: if (ticks_started) { urkle@7649: return; urkle@7649: } urkle@7649: ticks_started = SDL_TRUE; urkle@7649: slouken@1895: /* Set first ticks value */ slouken@1895: start = system_time(); slouken@0: } slouken@0: slouken@8268: void slouken@8268: SDL_TicksQuit(void) slouken@8268: { slouken@8268: ticks_started = SDL_FALSE; slouken@8268: } slouken@8268: slouken@1895: Uint32 slouken@1895: SDL_GetTicks(void) slouken@0: { urkle@7649: if (!ticks_started) { slouken@8268: SDL_TicksInit(); urkle@7649: } urkle@7649: slouken@1895: return ((system_time() - start) / 1000); slouken@0: } slouken@0: slouken@5514: Uint64 slouken@5514: SDL_GetPerformanceCounter(void) slouken@5514: { slouken@5514: return system_time(); slouken@5514: } slouken@5514: slouken@5514: Uint64 slouken@5514: SDL_GetPerformanceFrequency(void) slouken@5514: { slouken@5514: return 1000000; slouken@5514: } slouken@5514: slouken@1895: void slouken@1895: SDL_Delay(Uint32 ms) slouken@0: { slouken@1895: snooze(ms * 1000); slouken@0: } slouken@0: icculus@7981: #endif /* SDL_TIMER_HAIKU */ slouken@0: slouken@1895: /* vi: set ts=4 sw=4 expandtab: */