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

Author Topic: Time as float?  (Read 1982 times)

0 Members and 1 Guest are viewing this topic.

bglaze

  • Newbie
  • *
  • Posts: 46
    • View Profile
Time as float?
« on: November 03, 2011, 11:29:32 am »
I was taught that when programming, Time is is typically stored using an integer that represents milliseconds. However, I see that SFML uses floats to represent Time.

Should all of my sub-times that get assigned by and then compared to ElapsedTime() be floats? If I have them as as integers, will SFML have to convert them, thus using more (though I'm sure only slightly) processor power?

Or was I simply taught wrong, and using floats is actually the norm?

Thanks!!

P@u1

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
Time as float?
« Reply #1 on: November 03, 2011, 11:38:12 am »
SFML 2.0 uses unsigned int.

You should not care for processor power which is needed to convert between float and (unsigned) int, it won't have a noticeable effect.

bglaze

  • Newbie
  • *
  • Posts: 46
    • View Profile
Time as float?
« Reply #2 on: November 03, 2011, 07:43:08 pm »
Thank you, P@u1!

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Time as float?
« Reply #3 on: November 03, 2011, 10:38:12 pm »
Since it's been mentioned, can anyone tell me why was time changed from float to integer milliseconds? If I ever wanted an integer, I could always round the value. Why is it rounded for me?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Time as float?
« Reply #4 on: November 03, 2011, 11:02:54 pm »
There's a thread for this modification:
http://www.sfml-dev.org/forum/viewtopic.php?t=4864
Laurent Gomila - SFML developer