SFML community forums
Help => System => Topic started by: Law on September 02, 2015, 01:20:22 pm
-
Hello,
I would like to measure time non-relatively. This is because two distant computers are going to send timings to each other, and as a result there must be a universal Clock or something that they use to compare those timings. Is there a way to use sf::Clock in an absolute (non-relative) manner? If not, how would you advise me to solve this issue?
Thanks in advance.
-
No, sf::Clock measures time since its instantiation.
To access the current date and time, use the C++ standard library (http://en.cppreference.com/w/cpp/chrono), more specifically the header <ctime> (C) or <chrono> (C++11).
This does not solve the issue that two computers may have non-synchronized clocks. In order to address that, you could contact a time server using the NTP protocol.
-
Okay thank you, I'll try to do things differently then.