FAQ: Domain Time and NDIS Software Timestamps
This article applies to Domain Time II, version 5.2.b.20190701 or later.
Last Updated: 07 July 2019
Subject to further revisions as Microsoft continues developing and documenting software timestamping
Applicable operating systems: Windows 10 (version 1803 or later), and Windows Server 2019
Microsoft has introduced kernel-level support for UDP packet software timestamping at the NDIS layer of the TCP/IP network stack.
When enabled, NDIS timestamping uses QueryPerformanceCounter at the moment the NIC driver passes a packet to NDIS for
processing. This timestamp (based on TSC for all modern computers), can be passed up the stack along with the packet.
When the packet reaches Domain Time, Domain Time uses QueryPerformanceCounter to obtain the current tick count.
The simple formula ( (currentTick - NDISTick) * 10,000,000) / PerformanceFrequency) yields the number of hectonanoseconds
(10ths of a microsecond) it took the packet to transit the TCP/IP stack and perform any task-switching or kernel transitions
between when NDIS received the packet and when Domain Time received it.
Microsoft is also changing the frequency of the Performance Counter to 10,000,000 ticks/second on hardware that supports it.
This means the multiplication and division in the above formula may be omitted.
As of July 2019, only incoming software timestamping is supported. We will update this FAQ when outgoing software timestamping
is documented and supported by Microsoft.
In order to take advantage of software timestamping, you must first enable it. Eligible NICs are of ifType 6 (IF_TYPE_ETHERNET_CSMACD).
Wi-Fi, Bluetooth, Kernel debug, WAN Miniport, and VPN adapters are not supported.
Enabling Software Timestamping on Eligible NICs
You may use the DTCheck.exe program for this purpose:
|dtcheck -swTimestamps|| displays current settings|
|dtcheck -swTimestamps:Enable|| attempts to enable software timestamping|
|dtcheck -swTimestamps:Disable|| attempts to disable software timestamping|
|dtcheck -stats2|| shows statistics for NDIS timestamping|
|dtcheck -interfaces|| shows which interfaces have software timestamping enabled|
Microsoft provides a PowerShell script at PowerShellGallery to
enable or disable software timestamping. No matter which method you use to enable software timestamping, you must restart the NICs (or reboot the machine) to have
the change recognized.
Using Software Timestamping
By default, Domain Time will use software timestamping if it is available and enabled. The Advanced tab of the Control Panel applet has a checkbox
(ticked by default) to let you control this behavior. If software timestamping isn't supported by the operating system, the checkbox will be
Advantages of Software Timestamping
On heavily-loaded machines, or machines with highly-variable loads, the operating system can delay delivering an incoming packet to Domain Time
for an indeterminate period, ranging from a few microseconds to more than a millisecond. Software timestamping allows Domain Time to know when
a packet's delivery is late, and compensate for it. On lightly-loaded machines, the stack transit delay is more or less constant, so software
timestamping doesn't make much difference.
Disadvantages of Software Timestamping
Microsoft's current implementation does not use hardware timestamps provided by timestamping NICs, so jitter that arises as packets cross
the PHY-MAC junction, or that is introduced by the NIC driver itself, is not eliminated. Further, packets may be delayed due to congestion
(such as when performing a very large file copy), so the NIC driver may present them to the NDIS layer in a delayed manner that is not
detectable using software-only timestamping.
Domain Time II Software distributed by Microsemi, Inc.
Documentation copyright © 1995-2022 Greyware Automation Products, Inc.
All Rights Reserved
All Trademarks mentioned are the properties of their respective owners.