<div>OK.. you are probably right - "time when packet came to winpcap". However - that should not make much difference.</div><div>If packets are queued prior - I cannot affect that, and I will have to accept that jitter in timestamping process.</div>

<div><br></div><div>What I would want to achieve is to get minimum offset/jitter from there on.</div><div><br></div><div>I am trying to fix drift of two clocks...</div><div>As you might have seen - many user complained about drifting of the packets compared to systemtime:</div>

<div>for example:</div><div><a href="http://www.wireshark.org/lists/wireshark-users/201204/msg00038.html">http://www.wireshark.org/lists/wireshark-users/201204/msg00038.html</a></div><div><a href="http://ask.wireshark.org/questions/3893/timestamps-drift-from-real-time">http://ask.wireshark.org/questions/3893/timestamps-drift-from-real-time</a></div>

<div><br></div><div>Now I have external hadrware (lets say some AD time), which has its own clock source, which is totally independant from computer. That means that I always have clock drift.</div><div>I use some procedure to synchronize both clock (basically that means to put both clocks on same time axis), but for that to work perfect, I need to read current time from device. In this case from AD card and from winpcap driver.</div>

<div><br></div><div>Currently I use timestamp of packet that I read for synchronizing clocks, but that gives me additional offset (queue from winpcap driver to my reading of packets), which is not perfect and of course increases jitter...</div>

<div>If I would have some mechanism to get current clock from winpcap driver (I would need to read same counter that is used for timestamping packets, but I would need to read that counter on demand) I would be able to synchronize both clocks very precisely and would avoid longterm drift.</div>

<div><br></div><div>Best Regards,</div><div>Sašo Piskar</div><div><br><div class="gmail_quote">On Mon, Oct 8, 2012 at 2:46 PM, Black, Michael (IS) <span dir="ltr"><<a href="mailto:Michael.Black2@ngc.com" target="_blank">Michael.Black2@ngc.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Somebody correct me if I'm wrong here....<br>
<br>
But I do believe your statement "time when packet came to computer" is wrong.  It's tagged with "time when packet came to winpcap".<br>
<br>
Most OS's (all that I know of) have a TCP queue in the OS.  Winpcap retrieves from that and then tags.  So packets can queue up without being time tagged for a short while.<br>
<br>
What time drift are you trying to fix?  Does the computer you're running winpcap on have a problem?  Can't you just run NTP to fix that?  It automatically adjusts for drift on your computer clock.<br>
<a href="http://www.meinberg.de/english/sw/ntp.htm#ntp_nt_stable" target="_blank">http://www.meinberg.de/english/sw/ntp.htm#ntp_nt_stable</a><br>
<br>
NTP can usually achieve 1ms accuracy so you'll be left with some jitter for "time to winpcap" which should be notably sub 1ms but at least that jitter will not be drifiting on you.<br>
<br>
<div><br>
<div style="font-family:Tahoma;font-size:13px">
<p>Michael D. Black<br>
Senior Scientist<br>
Advanced Analytics Directorate<br>
Advanced GEOINT Solutions Operating Unit<br>
Northrop Grumman Information Systems<br>
</p>
</div>
</div>
<div style="font-size:16px;font-family:Times New Roman">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> <a href="mailto:winpcap-users-bounces@winpcap.org" target="_blank">winpcap-users-bounces@winpcap.org</a> [<a href="mailto:winpcap-users-bounces@winpcap.org" target="_blank">winpcap-users-bounces@winpcap.org</a>] on behalf of Sašo Piskar [<a href="mailto:saso.piskar@dewesoft.si" target="_blank">saso.piskar@dewesoft.si</a>]<br>



<b>Sent:</b> Monday, October 08, 2012 5:20 AM<br>
<b>To:</b> <a href="mailto:winpcap-users@winpcap.org" target="_blank">winpcap-users@winpcap.org</a><br>
<b>Subject:</b> EXT :[Winpcap-users] Timestamping<br>
</font><br>
</div><div><div>
<div></div>
<div>Hello,
<div><br>
</div>
<div>I am writing program to sniff ethernet packets.</div>
<div>With "pcap_next_ex" I nomally get the timestamp of the packet.</div>
<div>As I understand, timestamps are calculated with queryperformancecounter in the winpcap driver.</div>
<div><br>
</div>
<div>I need to synchronize those packets to some other clock (external device) to fix time drift problem.</div>
<div>If I just use timestamp of received packet, this is actually time when packet came to computer. I would also need to get current time (as precise as possible) in order to be able to synchronize packet timestamp with external clock.</div>



<div><br>
</div>
<div>Is there any way to get current clock from winpcap driver?</div>
<div><br>
</div>
<div>Best Regards,</div>
<div>Sašo</div>
<div>
<div><br>
</div>
<br>
<br>
</div>
</div>
</div></div></div>
</div>
</div>

<br>_______________________________________________<br>
Winpcap-users mailing list<br>
<a href="mailto:Winpcap-users@winpcap.org" target="_blank">Winpcap-users@winpcap.org</a><br>
<a href="https://www.winpcap.org/mailman/listinfo/winpcap-users" target="_blank">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>mail: <a href="mailto:saso.piskar@dewesoft.si" target="_blank">saso.piskar@dewesoft.si</a><br>phone: +386 59 07 16 49<br>DEWESoft - <a href="http://www.dewesoft.com" target="_blank">www.dewesoft.com</a><br>


<br>
</div>