Packet Sniffer SDK DLL Edition

HNAdapter :: Methods :: AdpGetOpenTime

 Previous Next

Returns the time of the latest opening of the current network adapter.

Syntax:

DWORD __stdcall AdpGetOpenTime(HANDLE hAdp, DWORD *HiValue);

Parameters:

hAdp

[in] HNAdapter object handle.

HiValue

[out] The pointer to the variable, in which the high DWORD of the result will be stored. May be set to NULL, if the application does not need these data.

Return values:

If the function succeeds, the return value will be the low-order doubleword of the time of the latest opening of the current network adapter, and if HiValue is non-NULL, the function will put the high-order doubleword of this time into the variable pointed to by this parameter.

Measurement units:

Windows NT 4.0/2000/XP/Vistahundreds of nanoseconds since January 1, 1600
Windows 95/98/ME0.8 microseconds since Windows session is started

Description:

This value is necessary to get a packet receiving time since the current adapter is opened. To calculate this time you should subtract this value from the pTimeStamp (see OnPacketReceive).

This function was introduced in the version 2.1 to allow an application developer to get packet receiving time value with the same sense for Windows 9x and Windows NT OS families.

If UseHighPrecisionTime property is set to TRUE, then in Windows NT based systems (NT/2k/XP/2k3/Vista) for obtaining a packet capture timestamp the kernel function KeQueryPerformanceCounter is used. Measurement units are hundreds of nanoseconds since the OS was restarted.

To get the network adapter opening time, please do the following:

...
ULARGE_INTEGER AdpOpenTime; // global variable
...
//---------------------------------------------------------------------------
// GetAdpOpenTime - get the network adapter opening time
//---------------------------------------------------------------------------
void GetAdpOpenTime()
 {
   AdpOpenTime.LowPart = AdpGetOpenTime(hAdp,&AdpOpenTime.HighPart);
 }
...
var
   AdpOpenTime : ULARGE_INTEGER; // global variable

implementation
...
//---------------------------------------------------------------------------
// GetAdpOpenTime - get the network adapter opening time
//---------------------------------------------------------------------------
procedure GetAdpOpenTime();
begin
   AdpOpenTime.LowPart := AdpGetOpenTime(hAdp,@AdpOpenTime.HighPart);
end;
See also:HNAdapter, AdpOpenAdapter, OnPacketReceive, AdpGetUseHighPrecisionTime