This is slightly off topic, but here's a brief explanation of timing under
Windows.
For extremely accurate measurement of time under Win32, I recommend
QueryPerformanceFrequency and QueryPerformanceCounter. Note however that
these functions are not implemented on all CPU's, so in case you see that it
is not available you should fall back on GetTickCount. Also, when using the
first two functions you must limit the thread that runs the timer checking
loop so that it can only run on one core, or you'll get unpredictable
results. Therefore I recommend having your timer in a separate thread with a
callback mechanism so that the rest of your threads are allowed to switch
CPU's at will for efficiency reasons.
Regards
Philip Bennefall
----- Original Message -----
From: "Peter Soxberger" <[EMAIL PROTECTED]>
To: "Discussion of the ENet library" <[email protected]>
Sent: Saturday, October 18, 2008 2:02 PM
Subject: Re: [ENet-discuss] How to get the ping?
Thats good to know!
I also want to get a correct ping value. Therefor I searched for something
similar to gettimeofday() for windows but I can't find anything. Which
function should I use under Windows to measure the ping in milliseconds?
Peter Soxberger
-------- Original-Nachricht --------
Datum: Fri, 17 Oct 2008 23:41:48 -0700
Von: Lee Salzman <[EMAIL PROTECTED]>
An: Discussion of the ENet library <[email protected]>
Betreff: Re: [ENet-discuss] How to get the ping?
The roundTripTime field should never be interpreted as a reliable all
purpose ping. It's solely for ENet's internal use. YMMV. Buyer beware.
Caveat emptor. Etc.
The best way to get an accurate ping for specific purposes it to
implement
a ping tailored for that purpose. Send a time value to the other end,
have
the other end send it back, check the difference, and do with it as you
will.
Lee
Ben Johnson wrote:
> Does anyone know how I would get the actual ping to a peer in Enet?
>
> I know you can get peer->roundTripTime.. but that's not the actual
> ping. It's an averaged value over the last x seconds. It also seems to
> start at 500 by default.. and because it's averaged, it takes a while
> for it to settle down to the actual ping.
>
> Thus.. when players join a game.. for the first 30seconds they warp
> all over the place because when I extrapolate by the latency it moves
> them forward by ~500ms, when the actual ping is like.. 50ms.
>
> Also, in my server lobby when I want to ping all servers.. I either
> have to wait for a few seconds until the ping levels out (seems
> pointless), or I get a highly inaccurate ping of ~400 or so.
>
>
> So surely there must be a way to get the raw, unaveraged ping of a
> peer? The very most recent one.
>
> Thanks,
> Ben.
>
_______________________________________________
ENet-discuss mailing list
[email protected]
http://lists.cubik.org/mailman/listinfo/enet-discuss
--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein:
http://www.shortview.de/[EMAIL PROTECTED]
_______________________________________________
ENet-discuss mailing list
[email protected]
http://lists.cubik.org/mailman/listinfo/enet-discuss
_______________________________________________
ENet-discuss mailing list
[email protected]
http://lists.cubik.org/mailman/listinfo/enet-discuss