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

Author Topic: Time.aSeconds returns 1e-006 ?  (Read 4760 times)

0 Members and 1 Guest are viewing this topic.

Chi

  • Newbie
  • *
  • Posts: 25
    • View Profile
Time.aSeconds returns 1e-006 ?
« on: March 15, 2013, 11:54:39 pm »
Hello all,

Quote from: cpp
        sf::Clock clock;
   sf::Time time;

   time = clock.getElapsedTime();
   std::cout << time.asSeconds() << std::endl;

if i put line 3 and 4 in the Game Loop, its shows seconds. But if  put it before the Game loop starts, it gives me a 1e-006. Why that happens?

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: Time.aSeconds returns 1e-006 ?
« Reply #1 on: March 16, 2013, 12:19:48 am »
If you do some math, you will see that this is a very small number. The reason it isn't 0 is because time IS passing as soon as the clock is created, and that number you see is that amount.
DSFML - SFML for the D Programming Language.

Chi

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Time.aSeconds returns 1e-006 ?
« Reply #2 on: March 16, 2013, 12:41:29 am »
Oh - you are right. I never thinked its a small number  ;D

thanks !

Sauce.

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Time.aSeconds returns 1e-006 ?
« Reply #3 on: May 22, 2013, 03:30:10 am »
That would be called scientific notation my friend look it up and it might help abit

 

anything