file_download

NTP Time Assistant for UWP

NTP Time Assistant for UWP

NTP Time Assistant for UWP is a Universal Windows Platform library to get current DateTime and DateTimeOffset instances based on a NTP request. It is considered to be used on Windows 10 IoT supported hardware platforms without a real time clock.

// create an instance of the time assistant
NTPTimeAssistant.Time.TimeAssistant timeAssistant = NTPTimeAssistant.Time.TimeAssistant.Instance;

// action on request timeout:
//     - false to return null
//     - true to throw a TimeoutException
bool throwExceptionOnTimeout = false;

// let it synchronize with the default NTP server
await timeAssistant.SynchronizeTimeAsync(throwExceptionOnTimeout);

// get your local time
DateTime localTime = timeAssistant.DateTime;

 

License

NTP Time Assistant for UWP is licensed under the Microsoft Public License.

Release notes

NTP Time Assistant for UWP v1.1.0.0
  • Optionally return null or throw a TimeoutExecption on request timeout

NTP Time Assistant for UWP v1.0.0.0
  • Query the default or a custom NTP server
  • Caches the offset between the hardware time and the time of the NTP server to avoid subsequent requests
  • Thread safe API