Is there any method for me to be able to retrieve the time and date from a remote computer using C #?
Is there any method for me to be able to retrieve the time and date from a remote computer using C #?
I found a solution using WMI in response in the SO . You do not like it.
you also have a solution calling net time
, horrible to my liking.
There are other solutions out there.
I prefer the solution using NTP in another response in the OS . A example implementation can be seen here . With the use of another answer in SO :
InternetTime.SNTPClient sntp = new InternetTime.SNTPClient("ntp1.ja.net");
sntp.Connect(false); // true to update local client clock
DateTime dt = sntp.DestinationTimestamp.AddMilliseconds(sntp.LocalClockOffset);
var timeStampNow = dt.ToString("dd/MM/yyyy HH:mm:ss.fff");