Loading...
Searching...
No Matches
sf::Clock Class Reference
Utility class that measures the elapsed time. More...
#include <SFML/System/Clock.hpp>
Public Member Functions | |
Time | getElapsedTime () const |
Get the elapsed time. | |
bool | isRunning () const |
Check whether the clock is running. | |
void | start () |
Start the clock. | |
void | stop () |
Stop the clock. | |
Time | restart () |
Restart the clock. | |
Time | reset () |
Reset the clock. | |
Detailed Description
Utility class that measures the elapsed time.
sf::Clock
is a lightweight class for measuring time.
The clock starts automatically after being constructed.
It provides the most precise time that the underlying OS can achieve (generally microseconds or nanoseconds). It also ensures monotonicity, which means that the returned time can never go backward, even if the system time is changed.
Usage example:
The sf::Time
value returned by the clock can then be converted to a number of seconds, milliseconds or even microseconds.
- See also
sf::Time
Member Function Documentation
◆ getElapsedTime()
|
nodiscard |
◆ isRunning()
|
nodiscard |
Check whether the clock is running.
- Returns
true
if the clock is running,false
otherwise
◆ reset()
Time sf::Clock::reset | ( | ) |
◆ restart()
Time sf::Clock::restart | ( | ) |
◆ start()
void sf::Clock::start | ( | ) |
Start the clock.
- See also
stop
◆ stop()
void sf::Clock::stop | ( | ) |
Stop the clock.
- See also
start
The documentation for this class was generated from the following file: