SDL_systimer.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #include "../../SDL_internal.h"
  19. #if defined(SDL_TIMER_DUMMY) || defined(SDL_TIMERS_DISABLED)
  20. #include "SDL_timer.h"
  21. static SDL_bool ticks_started = SDL_FALSE;
  22. void
  23. SDL_TicksInit(void)
  24. {
  25. if (ticks_started) {
  26. return;
  27. }
  28. ticks_started = SDL_TRUE;
  29. }
  30. void
  31. SDL_TicksQuit(void)
  32. {
  33. ticks_started = SDL_FALSE;
  34. }
  35. Uint64
  36. SDL_GetTicks64(void)
  37. {
  38. if (!ticks_started) {
  39. SDL_TicksInit();
  40. }
  41. SDL_Unsupported();
  42. return 0;
  43. }
  44. Uint64
  45. SDL_GetPerformanceCounter(void)
  46. {
  47. return SDL_GetTicks();
  48. }
  49. Uint64
  50. SDL_GetPerformanceFrequency(void)
  51. {
  52. return 1000;
  53. }
  54. void
  55. SDL_Delay(Uint32 ms)
  56. {
  57. SDL_Unsupported();
  58. }
  59. #endif /* SDL_TIMER_DUMMY || SDL_TIMERS_DISABLED */
  60. /* vi: set ts=4 sw=4 expandtab: */