Time Difference with precision

Reply

Join Date: Jul 2007
Posts: 1
Reputation: shuaibe is an unknown quantity at this point 
Solved Threads: 0
shuaibe shuaibe is offline Offline
Newbie Poster

Time Difference with precision

 
0
  #1
Jul 17th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,406
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1467
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Time Difference with precision

 
0
  #2
Jul 17th, 2007
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC