title: SDL_GetTicks() accuracy below the millisecond level
body: <p>I program currently something with SDL2.
  All works fine, but I have a problem with the <code>SDL_GetTicks()</code> method.
  Normally it should return the total application time in milliseconds, but it always returns most of the time the value 0 and sometimes the value 1.</p>
  
  <p>I initialized SDL with <code>SDL_INIT_EVERYTHING</code> flag.</p>
  
  <p>The problem with the following code is the loop is too fast, so the delta time is smaller than 1 ms. Is there a method to achieve a higher precision?</p>
  
  <pre><code>#include "Application.hpp"
  
  void Application::Initialize()
  {
      int sdl_initialize_result = SDL_Init(SDL_INIT_EVERYTHING);
      if(sdl_initialize_result &lt; 0)
      {
          std::cerr &lt;&lt; "Failed to initialize SDL !" &lt;&lt; std::endl &lt;&lt; SDL_GetError() &lt;&lt; std::endl;
      }
  
      window = SDL_CreateWindow("Project Unknown", 100, 100, 800, 600, SDL_WINDOW_SHOWN);
      if(window == nullptr)
      {
          std::cerr &lt;&lt; "Failed to create  SDL window !" &lt;&lt; std::endl &lt;&lt; SDL_GetError() &lt;&lt; std::endl;
      }
  
      last_update_time = SDL_GetTicks();
  }
  
  void Application::Dispose()
  {
      SDL_DestroyWindow(window);
      SDL_Quit();
  }
  
  void Application::Render()
  {
  }
  
  void Application::Update()
  {
      Uint32  current_time = SDL_GetTicks();
      Uint32  delta_time = current_time - last_update_time;
  
  
      SDL_Event event;
      while(SDL_PollEvent(&amp;event))
      {
          switch(event.type)
          {
              case SDL_QUIT:
              {
                  should_close = true;
              }
              break;
  
              default:
              {
  
              }
              break;
          }
      }
  
      // Update game objects with delta_time
  
      last_update_time = current_time;
  }
  
  
  void Application::Run()
  {
      Initialize();
  
      should_close = false;
      do
      {
          Render();
          Update();
      }
      while(should_close == false);
  
      Dispose();
  }
  </code></pre>