31
SFML development / sf::Time & sf::Clock vs C++11 chrono
« on: March 08, 2017, 12:58:37 pm »
Info & Rules about this sub-forum
With C++11 we finally got access to <chrono> a native and thus cross-platform C++ standard library timing and clock functionalities.
SFML 2.x and earlier has introduced its own sf::Clock and later sf::Time classes to deal with time dependent functionalities internally but also as library features, useful in pretty much any application.
Questions are now:
Summary
With C++11 we finally got access to <chrono> a native and thus cross-platform C++ standard library timing and clock functionalities.
SFML 2.x and earlier has introduced its own sf::Clock and later sf::Time classes to deal with time dependent functionalities internally but also as library features, useful in pretty much any application.
Questions are now:
- Should we completely drop sf::Time and sf::Clock?
- Or should we keep the classes but internally use <chrono>?
- What are your arguments for either situation?
- Do you have any concerns about <chrono>?
(click to show/hide)
(click to show/hide)
Summary
- Keep sf::Time
- Internally use std::chrono::nanoseconds
- Add conversion from and to std::chrono::duration
- Internally use std::chrono::nanoseconds
- Make sf::Clock a stopwatch