Beispiel #1
0
 public static void Main()
 {
     // Initializes the time client
     SNTP_Client TimeClient = new SNTP_Client(new IntegratedSocket("time-a.nist.gov", 123));
     // Displays the time in three ways:
     Debug.Print("Amount of seconds since 1 jan. 1900: " + TimeClient.Timestamp.ToString());
     Debug.Print("UTC time: " + TimeClient.UTCDate.ToString());
     Debug.Print("Local time: " + TimeClient.LocalDate.ToString());
     // Synchronizes the internal clock
     TimeClient.Synchronize();
 }
Beispiel #2
0
 /// <summary>
 /// Synchronizes with an NTP-server
 /// </summary>
 /// <param name="Server">The telnet server object</param>
 /// <param name="NtpServer">Hostname of the NTP server</param>
 private static void Sync(TelnetServer Server, string NtpServer)
 {
     SNTP_Client Client = new SNTP_Client(new IntegratedSocket(NtpServer, 123));
     Client.Synchronize();
     Server.Print("Current time: " + DateTime.Now.ToString());
 }