I need to know if there is any .NET API exists to fetch the current time from Internet Time Server, so that changing the system time at the client will not affect the integrity of my application.
Asked
Active
Viewed 7,453 times
4 Answers
2
There's a third party library that should bail you out. See the NtpClient class
For other alternatives, see the similar thread here
1
You can use third party NTPClient.cs.
Example how to use:
DateTime time_nist_gov = NTPClient.GetTime().TransmitTimestamp; // uses NTPClient.DefaultTimeServer = "time.nist.gov"
DateTime time_windows_com = NTPClient.GetTime("time.windows.com").TransmitTimestamp;
DateTime pool_ntp_org = NTPClient.GetTime("pool.ntp.org").TransmitTimestamp;

stomy
- 1,778
- 1
- 15
- 16