MatthewKing / guerrillantp

Simple NTP (SNTP) client library providing .NET applications with accurate network time.

Home Page:https://guerrillantp.machinezoo.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GuerrillaNtp

GuerrillaNtp is a simple NTP (SNTP) client written in C# that can be embedded in desktop .NET applications to provide them with accurate network time even when the system clock is unsynchronized.

// query the SNTP server
TimeSpan offset;
using (var ntp = new NtpClient(Dns.GetHostAddresses("pool.ntp.org")[0]))
    offset = ntp.GetCorrectionOffset();

// use the offset throughout your app
var accurateTime = DateTime.UtcNow + offset;

About

Simple NTP (SNTP) client library providing .NET applications with accurate network time.

https://guerrillantp.machinezoo.com/

License:Apache License 2.0


Languages

Language:C# 100.0%