private void Initialize() { if (RemoteSNTPServer == null) { RemoteSNTPServer = SNTPSettings.GetSNTPServer(); } }
/// <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)); }
/// <summary> /// /// </summary> /// <param name="timeout"></param> /// <returns></returns> public static double GetLocalClockOffset(TimeSpan timeout) { return(GetLocalClockOffset(SNTPSettings.GetSNTPServer(), timeout)); }
/// <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)); }