# SDL2: lag with SDL\_GetTicks

**URL:** <https://discourse.libsdl.org/t/sdl2-lag-with-sdl-getticks/25538>\
**Category:** SDL Development\
**Created:** [January 4, 2019, 9:32pm UTC](https://discourse.libsdl.org/t/sdl2-lag-with-sdl-getticks/25538 "2019-01-04T21:32:43Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Daniel\_Gibson](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/daniel_gibson/32/3010_2.png) [@Daniel\_Gibson](https://discourse.libsdl.org/u/Daniel_Gibson)\
**Post date:** [January 23, 2019, 2:58am UTC](https://discourse.libsdl.org/t/sdl2-lag-with-sdl-getticks/25538/6 "2019-01-23T02:58:47Z")

</div>

This behaviour was a bug.  
This “enumerate every 3 seconds” thing is implemented to support hotplugging (=\> detecting new devices or if existent ones have been unplugged) - but it _should_ only be used in case the operating system can’t tell you about those events.  
Not sure which operating systems support/don’t support sending you plug/unplug-events, but Windows certainly _does_ support it, so it _shouldn’t_ happen (on Windows it should only be used if telling Windows to send those events failed).

The bug in 2.0.9 is basically that if you don’t activate joysticks via `SDL_Init()`, the internal flag for “operating system will send events” is not set, and because of that the frequent enumerations are done (the fix was to not do those enumerations at all if joysticks aren’t enabled).  
So one possible workaround (if you want to use unpatched 2.0.9) is to pass `SDL_INIT_JOYSTICK` to `SDL_Init()`, even if you don’t otherwise use/support joysticks. (I think doing this shouldn’t “hurt” or cause additional events, because you should only get input events from joysticks if you have enabled a particular joystick with `SDL_JoystickOpen()` or `SDL_GameControllerOpen()`.)

---

_[View the full topic](https://discourse.libsdl.org/t/sdl2-lag-with-sdl-getticks/25538)._
