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

Author Topic: Switched times to Uint32 milliseconds in SFML 2  (Read 37900 times)

0 Members and 1 Guest are viewing this topic.

The DarK'

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Switched times to Uint32 milliseconds in SFML 2
« Reply #60 on: December 25, 2011, 09:35:21 pm »
Quote from: "TomCatFort"
Well micro is still a thousand times better then milis! :D


Indeed !

However, the last git version doesn't provide the micro.


A possible solution, in order to keep the S of SFML, and deliver the exact nanosecond time : provide 2 functions.

GetElapsedTime() / GetFrameTime(); // In float (second), easy to manipulate. (Sprite.Move(ElapedTime * 20, 0) for example).

GetPreciseElapsedTime()  / GetPreciseFrameTime(); // In nanosecond.


So, everybody is happy  :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Switched times to Uint32 milliseconds in SFML 2
« Reply #61 on: December 25, 2011, 10:05:08 pm »
I'm currently working on a new API for timing, don't worry ;)
Laurent Gomila - SFML developer

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Switched times to Uint32 milliseconds in SFML 2
« Reply #62 on: January 02, 2012, 09:52:13 pm »
Any news/ETA on this? Right now I simply wait for at least 10 ms to pass, before adding up frame times, as a workaround. However I'd prefer going back to a simple "time += timer.GetElapsedTime()" to determine the timeframe I have to update.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Switched times to Uint32 milliseconds in SFML 2
« Reply #63 on: January 02, 2012, 10:54:54 pm »
The time API will be updated soon, with a big surprise :lol:
Laurent Gomila - SFML developer

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Switched times to Uint32 milliseconds in SFML 2
« Reply #64 on: January 03, 2012, 12:22:06 am »
Quote from: "Laurent"
The time API will be updated soon, with a big surprise :lol:
We can measure time down to the planck scale?!
I use the latest build of SFML2

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Switched times to Uint32 milliseconds in SFML 2
« Reply #65 on: January 03, 2012, 08:01:33 am »
Quote
We can measure time down to the planck scale?!

No, you'll have to wait for SFML 172.0 to get this feature.

The big surprise is not about the time API.
Laurent Gomila - SFML developer

Klaim

  • Full Member
  • ***
  • Posts: 137
    • View Profile
Switched times to Uint32 milliseconds in SFML 2
« Reply #66 on: January 04, 2012, 01:05:16 am »
Use of std::chrono-like code maybe? :D

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Switched times to Uint32 milliseconds in SFML 2
« Reply #67 on: January 04, 2012, 07:49:05 am »
Quote
Use of std::chrono-like code maybe?

A little bit. But it will remain very simple.
Laurent Gomila - SFML developer

Tronic

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • http://performous.org/
Re: Switched times to Uint32 milliseconds in SFML 2
« Reply #68 on: June 25, 2012, 01:38:39 am »
The Time/seconds API should be changed so that it uses double rather than float. As shown previously, float is not precise enough for timing.

minirop

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
    • http://dev.peyj.com
Re: Switched times to Uint32 milliseconds in SFML 2
« Reply #69 on: June 25, 2012, 02:49:10 am »
float is not precise enough for timing.
did you look at the source code ? internally it's a Uint64 (so microseconds) and it's cast to float when asked.
float Time::asSeconds() const
{
    return m_microseconds / 1000000.f;
}
if you really need floating and accuracy, take asMicroseconds and cast it yourself to double.