Toolbox.NETMF.NET.SNTP_Client


Toolbox.NETMF.NET.SNTP_Client(Socket)
  • Socket A reference for the socket to be used (see also: SimpleSocket)

Methods

  • Synchronize() Synchronizes the clock with the NTP server

Properties

  • Timestamp The amount of seconds since 1 jan. 1900
  • UTCDate The current date and time in UTC
  • LocalDate The local date and time

Sample code in C#

// 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();

Sample code in VB

' Initializes the time client
Dim TimeClient As SNTP_Client = 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()

Last edited Jan 30, 2012 at 9:29 PM by Garrcomm, version 1