Jump to content
  • Advertisement
Sign in to follow this  
dustydoodoo

TimeGetTime()?

This topic is 5135 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

float currentTime = timeGetTime() * 0.001f; How does timeGetTime() work, and why is there an 'f' at the end of that number? What is it for? Or what does it mean?

Share this post


Link to post
Share on other sites
Advertisement
timeGetTime gets the time in MS (roughly, it will return the time within a precision (see timeBeginPeriod/timeEndPeriod) actually, as it's not perfectly accurate always.). The f stands for float, and makes that a const float

Share this post


Link to post
Share on other sites
Quote:
Original post by dustydoodoo
why is there an 'f' at the end of that number? What is it for? Or what does it mean?


f = float(I think). Some compilers have issues if you use something like: DoStuff(32); and not DoStuff(32.0f);

Edit: >_< Beaten by Washu in milliseconds.

Share this post


Link to post
Share on other sites
timeGetTime() returns the number of milliseconds that has passed since a given milestone (I don't remember which one exactly, but a trip to your friendly neighbourhood documentation would tell you that, much as it would tell you what timeGetTime() does in general...).

An f following a constant value indicates that you want that value interpreted as a float value. Without that there, it would be interpreted as a double, which of course doesn't match the data type it's being stuffed in.

Lastly, I don't know if you asked for this in specific, but it's multiplying by 0.001f because they want to convert from milliseconds to seconds, and that would be how.

-Auron

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!