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

Author Topic: understand sf::Time  (Read 2125 times)

0 Members and 1 Guest are viewing this topic.

digimikeh

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Email
understand sf::Time
« on: April 11, 2021, 02:07:12 am »
Hi!

does sf::Time stores an static point of time from clock or it is constantly taking the time from clock?...

example:

sf::Clock clk;
//do some things
sf::Time t0 = clk.getElapsedTime();             //N0
//... do some other things that take a while
std::cout << t0.asSeconds();                       //N1
 


N0: lets suppose here the time is 0.002

N1: does t0 is the same time point as before or it will print a later value?.. for instance 0.01

Oh yeah!!.. i have tried it on my own... but stdout prints an e+10 very large number...
Thanks
« Last Edit: April 11, 2021, 02:08:52 am by digimikeh »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: understand sf::Time
« Reply #1 on: April 11, 2021, 04:29:36 pm »
sf::Time is simply a value. It doesn't change on its own.

Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything