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

Author Topic: Clock::GetElapsedTime()  (Read 4730 times)

0 Members and 1 Guest are viewing this topic.

dunce

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Clock::GetElapsedTime()
« on: October 23, 2009, 05:33:16 am »
This function returns elapsed seconds as float. Thus the clock that starts with an application will lose its milliseconds in 27 hours. For stand-alone game it may be ok. No one would play the whole day and night through.  :)  But for some applications it may not be suitable. For my engine's task scheduler I need a clock with millisecond's precision and unsigned long capacity. Why not to extend sf::Clock with an appropriate function that returns elapsed milliseconds as unsigned long like Ogre's getMilliseconds()? The lack of this function makes developers implement their own timers or use 3d-party's ones.

dunce

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Clock::GetElapsedTime()
« Reply #1 on: October 23, 2009, 10:36:13 am »
Finaly I decided to create a full-featured Timer class that would work correctly with multi-core CPUs and could fire events. Though sf::Clock may be helpful for simple things.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Clock::GetElapsedTime()
« Reply #2 on: October 24, 2009, 12:04:27 pm »
I already received a patch for this and I'll fix it in SFML 2.
Laurent Gomila - SFML developer