Re: [AD] windows time functions

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Jan 29, 2008 12:15 PM, Ryan Dickie <goalieca@xxxxxxxxxx> wrote:
Windows has an article here about game timers on multiprocessor systems. Looks awfully kludged.

http://msdn.microsoft.com/library/default.asp?url="">

--ryan


On Jan 29, 2008 6:08 AM, allefant <allefant@xxxxxxxxxx> wrote:
On Jan 29, 2008 2:19 PM, AJ <aj@xxxxxxxxxx> wrote:
>
> Problems with timeGetTime() :
>
> unless you run the  timeBeginTime()  and timeEndTime()
> timeGetTime()'s resolution can be as much as 8-10ms sloppy.
> which for anything like trying to sync a screen draw/flip  can cause
> significant error in calculations.
>

Read back a bit, only a few weeks ago the issue was raised (by me).
And it's on the topic list for the meeting on the weekend. Hopefully,
we will just switch to using double representing seconds, or else
int64_t representing either us or ns. Then it's up to drivers to
implement as much precision/accuracy as they can. In linux, it should
be easy to stay in us area by simply using gettimeofday().. about
Windows someone hopefully figures out an implementation which also
deals with threading and so on (what you raised above).

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
--
https://lists.sourceforge.net/lists/listinfo/alleg-developers


Me and Trent did some work on the allegro windows timers tonight. wtimernu.c is now just a copy of utimernu.c We could probably pull it right out of the platform specific code now.

Trent also added a high-res and low-res al_current_time() function with the high res using QPC and the low res using the timeGetTime. Once we added timeBeginPeriod(1) the periodic timer error went from ~3ms to 0.2ms (ya.. 200us is kinda low. i still don't quite believe it). For reference the error on linux is roughly 1.5ms for the periodic timer (basically nanosleeps error).

-- Ryan Dickie


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/