sf::Clock clock; sf::Time elapsed = clock.restart(); std::cout << elapsed.asMicroseconds() << std::endl;
sf::Clock clock; while (true) { if (clock.getElapsedTime().asSeconds() > 1) { // do something break; } }In this example, we use the sf::Clock class to measure the elapsed time since the start of the program. We then use the asSeconds() method of the sf::Time class to get the elapsed time in seconds. We delay the execution of a function by checking if the elapsed time is greater than one second. Package library: SFML (Simple and Fast Multimedia Library) is a free and open-source software package library that provides various modules for developing multimedia applications and games using C++. The sf::Time class is a part of the SFML system.