Beispiel #1
0
 private void Initialize()
 {
     if (RemoteSNTPServer == null)
     {
         RemoteSNTPServer = SNTPSettings.GetSNTPServer();
     }
 }
Beispiel #2
0
 /// <summary>
 /// Gets the real local date and time using the default server and the specified timeout.
 /// If there is an error or exception, DateTime.MinValue is returned.
 /// </summary>
 /// <param name="timeout">The timeout in milliseconds used for sending and receiving.</param>
 /// <returns>The real local date and time.</returns>
 public static DateTime GetNow(TimeSpan timeout)
 {
     return(GetNow(SNTPSettings.GetSNTPServer(), timeout));
 }
Beispiel #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="timeout"></param>
 /// <returns></returns>
 public static double GetLocalClockOffset(TimeSpan timeout)
 {
     return(GetLocalClockOffset(SNTPSettings.GetSNTPServer(), timeout));
 }
Beispiel #4
0
 /// <summary>
 /// Gets the real local date and time using the default server and a total timeout of 1 second.
 /// If there is an error or exception, DateTime.MinValue is returned.
 /// </summary>
 /// <returns>The real local date and time.</returns>
 public static DateTime GetNow()
 {
     return(GetNow(SNTPSettings.GetSNTPServer(), SNTPSettings.GetConfigOrDefault().Timeout));
 }