PDA

View Full Version : Calculating round trip packet time


webmastermattd
05-23-2003, 05:32 AM
Greetings all,

I am still working on getting a version of ping going (just for the fun of it) though am not too sure about how to calculate the time that it takes to send and recieve the ICMP packet.

Any help on implementation stratergies would be of great use.

What i am currently doing is saving the time that the packet was sent in a time_t struct, and then again when it is recieved in a different time_t struct and using difftime(); to get the difference between the two. This unfortunantly will often result in a difference of 0 which is not what I am after (more accuracy is needed).

Also, if anyone knows of any good tutorials or books on the different socket options that can be implemented with setsockopt(); it would be of great help.

Later,

RobSeace
05-23-2003, 11:36 AM
See this recent post (http://www.developerweb.net/forum/viewtopic.php?t=515) about timing things...

But, for the record "time_t" is NOT a struct (on any system
that I'm aware of, at least)... It's a simple "long" int... And, yes,
that only gives you second precision, which is probably not
nearly good enough for any good ping implementation...