<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE>.hmmessage P {
        PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
BODY.hmmessage {
        FONT-SIZE: 10pt; FONT-FAMILY: Verdana
}
</STYLE>

<META content="MSHTML 6.00.2900.5726" name=GENERATOR></HEAD>
<BODY class=hmmessage bgColor=#ffffff>
<DIV><FONT face="Courier New">There is no way to do that directly. </FONT></DIV>
<DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New">A way to do that is to create some custom 
application that periodically takes the values for QueryPerformanceCounter and 
QuerySystemTime, and then massages the timestamps interpolating the 
values.</FONT></DIV>
<DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New">Also, if you close the winpcap instance 
(pcap_close) and there are *no* other capture instances on the system, the 
QueryPerformanceCounter value is re-synchronized.</FONT></DIV>
<DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New">Finally,&nbsp;you can&nbsp;create files every 
hour, and between each file close the winpcap instance, stop the winpcap driver 
and restart it (so that the value is latched again).</FONT></DIV>
<DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New">Have a nice day</FONT></DIV>
<DIV><FONT face="Courier New">GV</FONT></DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=nico_de_moor@hotmail.com href="mailto:nico_de_moor@hotmail.com">nico 
  de moor</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=winpcap-users@winpcap.org 
  href="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, December 18, 2009 7:21 
  AM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> [Winpcap-users] Dumpcap 
  timestampdiscrepancy after extended period of time</DIV>
  <DIV><FONT face="Courier New"></FONT><FONT face="Courier New"></FONT><FONT 
  face="Courier New"></FONT><BR></DIV>Hi,<BR><BR>We have several trace PC's 
  (synchronized with NTP server) which are continuously capturing packets in our 
  VOIP network, when we need to analyze a call we filter out these calls and 
  want to merged them chronologically but the timestamps in the files do not 
  match when the traces are running for an extended period of time due to the 
  timestamp mode set to 'generated through KeQueryPerformanceCounter' - when we 
  change the timestamp mode setting to 'generated through KeQuerySystemTime' the 
  time is correct but due to the high amount of traffic in our network we have 
  lots of packets with the same time stamp which is also not workable.<BR><BR>Is 
  it possible to have the timestamp generated through PerformanceCounter but 
  periodically updated (e.g. with creation of new file or once every hour) with 
  the system time?<BR><BR>Br. Nico&nbsp; &nbsp; 
  <BR><BR><BR>-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------<BR><PRE>&gt;From: <A href="https://www.winpcap.org/mailman/listinfo/winpcap-users">winpcap-users-bounces at winpcap.org</A> [<A href="https://www.winpcap.org/mailman/listinfo/winpcap-users">winpcap-users-bounces at winpcap.org</A>] On Behalf Of Gianluca Varenni [<A href="https://www.winpcap.org/mailman/listinfo/winpcap-users">gianluca.varenni at cacetech.com</A>]<BR>&gt;Sent: Thursday, April 16, 2009 15:03<BR>&gt;To: <A href="https://www.winpcap.org/mailman/listinfo/winpcap-users">winpcap-users at winpcap.org</A><BR>&gt;Subject: Re: [Winpcap-users] FW: [Wireshark-users] FW: Dumpcap  timestampdiscrepancy<BR>&gt;<BR>&gt;What happens is that the WinPcap driver synchronizes with the system clock<BR>&gt;when you start the capture, and then uses the timestamps returned by<BR>&gt;KeQueryPerformanceCounter, which represent the number of 100ns ticks since<BR>&gt;boot time. Such clock doesn't get resynchronized when your machine<BR>&gt;synchronizes its clock on the network with NTP or similar systems.<BR>&gt;<BR>&gt;If you accept a timestamp precision in the order of some milliseconds, the<BR>&gt;workaround is to switch the timestamping mode to the system time, which has<BR>&gt;a granularity in the order of 10-15milliseconds.<BR>&gt;<BR>&gt;This can be done by modifying a registry key:<BR>&gt;       HKLM\System\CurrentControlSet\Services\NPF\TimestampMode<BR>&gt;  Possible values are<BR>&gt;   * 0 (default) -&gt; Timestamps generated through KeQueryPerformanceCounter,<BR>&gt;          less reliable on SMP/HyperThreading machines,<BR>&gt;          precision = some microseconds<BR>&gt;   * 2 -&gt; Timestamps generated through KeQuerySystemTime,<BR>&gt;   more reliable on SMP/HyperThreading machines,<BR>&gt;          precision = scheduling quantum (10/15 ms)<BR>&gt;   * 3 -&gt; Timestamps generated through the i386 instruction RDTSC,<BR>&gt;          less reliable on SMP/HyperThreading/SpeedStep machines,<BR>&gt;          precision = some microseconds<BR>&gt;<BR>&gt;After that you need to restart the npf service (or reboot your machine).<BR>&gt;<BR>&gt;Have a nice day<BR>&gt;GV<BR><BR><BR>----- Original Message -----<BR>From: "Phil Paradis" &lt;<A href="https://www.winpcap.org/mailman/listinfo/winpcap-users">Phil.Paradis at unitedtote.com</A>&gt;<BR>To: &lt;<A href="https://www.winpcap.org/mailman/listinfo/winpcap-users">winpcap-users at winpcap.org</A>&gt;<BR>Sent: Wednesday, April 15, 2009 11:58 PM<BR>Subject: [Winpcap-users] FW: [Wireshark-users] FW: Dumpcap<BR>timestampdiscrepancy<BR><BR><BR>&gt;<I>I was referred here from the wireshark-users list; here's the original<BR></I>&gt;<I>post:<BR></I>&gt;<I><BR></I>&gt;<I> Phil Paradis wrote:<BR></I>&gt;&gt;<I> We have a sniffer running continuously in one of our facilities,<BR></I>&gt;&gt;<I> capturing<BR></I>&gt;&gt;<I> data to/from a specific system. The box is running Windows XP Pro (SP-3)<BR></I>&gt;&gt;<I> and<BR></I>&gt;&gt;<I> dumpcap is running as a service using srvany.exe. The clock on this<BR></I>&gt;&gt;<I> system is<BR></I>&gt;&gt;<I> synchronized with the rest of the hosts on this network.<BR></I>&gt;&gt;<I><BR></I>&gt;&gt;<I> When left running for an extended period of time (weeks/months) it seems<BR></I>&gt;&gt;<I> the<BR></I>&gt;&gt;<I> timestamps recorded in our captures slowly drift backwards. The timestamp<BR></I>&gt;&gt;<I> recorded in the filename as each new file is created matches the system<BR></I>&gt;&gt;<I> time<BR></I>&gt;&gt;<I> relatively well (from observation; i.e. when BAT_99717_20090415222212.cap<BR></I>&gt;&gt;<I> was<BR></I>&gt;&gt;<I> created, the system clock showed 10:22 PM.) however the packet timestamps<BR></I>&gt;&gt;<I> within the file are off by a significant amount. (In this particular<BR></I>&gt;&gt;<I> example,<BR></I>&gt;&gt;<I> the first packet in the file has a timestamp of 22:16:18, nearly 6<BR></I>&gt;&gt;<I> minutes<BR></I>&gt;&gt;<I> earlier than when the file was opened.)<BR></I>&gt;&gt;<I><BR></I>&gt;&gt;<I> Stopping and restarting the service seems to correct this; after a<BR></I>&gt;&gt;<I> restart,<BR></I>&gt;&gt;<I> the first packet in the new file had a timestamp closely matching the<BR></I>&gt;&gt;<I> timestamp in the filename (and the system time.)<BR></I>&gt;&gt;<I><BR></I>&gt;&gt;<I> What documentation I can find seems to indicate that WinPCap obtains the<BR></I>&gt;&gt;<I> timestamp from the system as packets are received; since the system<BR></I>&gt;&gt;<I> itself<BR></I>&gt;&gt;<I> reflects the correct time, the discrepancy we are seeing strikes me as<BR></I>&gt;&gt;<I> rather<BR></I>&gt;&gt;<I> odd. Has anyone else seen this or know what could cause it?<BR></I>&gt;&gt;<I><BR></I>&gt;&gt;<I> The command line used to start Dumpcap from SrvAny is:<BR></I>&gt;&gt;<I><BR></I>&gt;&gt;<I> -i \Device\NPF_{ABF2B612-CEAA-46CE-BEEB-D401F37BAEFF} -B 8 -b<BR></I>&gt;&gt;<I> filesize:5000<BR></I>&gt;&gt;<I> -b files:5000 -w c:\sniff\BAT.cap<BR></I>&gt;&gt;<I><BR></I>&gt;&gt;<I> The version of Wireshark we are using is 1.0.0, with WinPcap 4.0.2. (Yes,<BR></I>&gt;&gt;<I> I<BR></I>&gt;&gt;<I> know it's old. We can easily update to the latest version, but I figured<BR></I>&gt;&gt;<I> I'd<BR></I>&gt;&gt;<I> ask anyway in case anyone knows of a different cause for this issue.)<BR></I>&gt;&gt;<I><BR></I>&gt;&gt;<I> Thanks,<BR></I>&gt;&gt;<I><BR></I>&gt;&gt;<I> -- Phil</I></PRE><A 
  href="https://www.winpcap.org/mailman/listinfo/winpcap-users"><BR></A><BR>
  <HR>
  Express yourself instantly with MSN Messenger! <A 
  href="http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/" target=_new>MSN 
  Messenger</A> 
  <P>
  <HR>

  <P></P>_______________________________________________<BR>Winpcap-users 
  mailing 
  list<BR>Winpcap-users@winpcap.org<BR>https://www.winpcap.org/mailman/listinfo/winpcap-users<BR></BLOCKQUOTE></BODY></HTML>