Boost logo

Boost Users :

From: Christian Henning (chhenning_at_[hidden])
Date: 2007-06-07 22:24:10


Hi there, I think there is something wrong with the timer. Whenever I
run the code ( see below ) it slows down for whatever reason. Is that
a known problem? When I look at the output the frequency is certainly
not 10 times a second.

#include <windows.h>
#include <iostream>
#include <sdl.h>

using namespace std;

Uint32 time_elapsed( Uint32 interval, void* param )
{
   cout << interval << endl;

   return ++interval;
}

int main( int argc, char* argv[] )
{
   SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER );

   SDL_TimerID id = SDL_AddTimer( 100, &time_elapsed, NULL );

   SDL_Event event;

   while( SDL_PollEvent( &event ) >= 0 ) { ::Sleep( 100 ); }

   return 0;
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net