Couldn't find any information about this so I figuered i'd had to ask
We're currently working on a game projekt and we've done some prototyping in SFML.. From what we can see a sf::Clock will return incorrect values if used along with a sleep.
example1:
sf::Clock Clock;
while(true)
{
//do some stuff, break after 60 seconds
Sleep(1);
}
std::cout << Clock.GetElapsedTime() << std::endl;
we tested with a stop watch and broke the loop manually after 60 seconds, the Clock.GetElapsedTime() would return a value of ~35 seconds.
example2:
sf::Clock Clock;
while(true)
{
//do some stuff, break after 60 seconds
//Sleep(1);
}
std::cout << Clock.GetElapsedTime() << std::endl;
with the sleep out of the way, and the programm still running for 60 seconds, it returned a far more precise value.
Is there something we're doing wrong or is this a bug?
to work around it we're using floats in wich we add all the sleep values and then add the Clocks time.
edit: I'm using windows XP btw.