944,093 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 5640
  • C RSS
Jul 17th, 2007
0

Time Difference with precision

Expand Post »
Hello,

Iam trying to calculate packet delay from server to client. Iam capturing the packets using WireShark and filtering them out on both sides to calculate the delay by computing difference between their timestamps.
In WireShark, I can get the timestamps in both Epoch & in HH: MM: SS format with nanosecond precision. The timestamps I read from the file are char array type
1. How can I convert strings to a time format which can be used to compute time difference with high precision ?

The difftime() function computes time difference in epoch units but with only seconds precision.

2. How can I computer time difference with high precision ? Is there any other method than difftime() ?

Thank you for your time!

shuaib
Last edited by shuaibe; Jul 17th, 2007 at 6:21 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shuaibe is offline Offline
1 posts
since Jul 2007
Jul 17th, 2007
0

Re: Time Difference with precision

1. Just parse the string. If you already know the time format then it is not very difficult to split the string into its individual parts (hours, minutes, seconds, milliseconds).

2. The milliseconds is not very useful when the time difference is greater than probably one minute. If the difference is less than one minute then just convert both times to milliseconds and subtract them.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is online now Online
21,960 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: How to correctly use the getuserattr and putuserattr in "C"
Next Thread in C Forum Timeline: help on turbo c: creating a truth table please..





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC