Why do you use short for the time? You should use sf::Time instead
Test example:
sf::Clock time;
sf::Clock clocker;
sf::Time timeSinceUpdate = sf::Time::Zero;
sf::Time msUpdateTime = sf::milliseconds(1000);
while (time.getElapsedTime() <= sf::seconds(10))
{
timeSinceUpdate += clocker.restart();
if (timeSinceUpdate >= msUpdateTime)
{
std::cout << "Time: " << time.getElapsedTime().asMilliseconds();
timeSinceUpdate -= msUpdateTime;
//Code
}
}
TimeSinceUpdate will only be in very rare cases exactly msUpdateTime so the next tick should consider the "overtime" of the last tick. (timeSinceUpdate -= msUpdateTime; )
For me, the code above works perfectly.
AlexAUT