예제 #1
0
파일: NTPClient.cs 프로젝트: cxdcxd/RRS
 public void sync(string host_name)
 {
     try
     {
         var connection = new NtpConnection(host_name);
         stop_watch = new Stopwatch();
         stop_watch.Stop();
         var utcNow = connection.GetUtc();
         stop_watch.Start();
         time_offset = (long)(utcNow - new DateTime(1970, 1, 1)).TotalMilliseconds;
         reportLog("NTP Sync successful", LogType.INFO, "NTPClient");
         reportLog("Current time is : " + get(), LogType.INFO, "NTPClient");
     }
     catch (Exception e)
     {
         string msg = e.Message;
         reportLog("Error in time sync : " + msg, LogType.ERROR, "NTPClient");
     }
 }
예제 #2
0
파일: Net2NTP.cs 프로젝트: cxdcxd/RRS
 public Net2NTP(string ntpServer)
 {
     var connection = new NtpConnection(ntpServer);
 }