Catch the time on a remote computer using C #

4

Is there any method for me to be able to retrieve the time and date from a remote computer using C #?

    
asked by anonymous 28.09.2016 / 16:20

1 answer

4

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");
    
28.09.2016 / 16:27