Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Absolute Time  (Read 4530 times)

0 Members and 1 Guest are viewing this topic.

Law

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Absolute Time
« 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.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Absolute Time
« Reply #1 on: September 02, 2015, 01:28:10 pm »
No, sf::Clock measures time since its instantiation.

To access the current date and time, use the C++ standard library, 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.
« Last Edit: September 02, 2015, 01:30:08 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Law

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: Absolute Time
« Reply #2 on: September 15, 2015, 06:05:36 pm »
Okay thank you, I'll try to do things differently then.

 

anything