tcp.getCurrentTime

Syntax tcp.getCurrentTime (server="time-b.timefreq.bldrdoc.gov", flMessages=true)

Params host is a string, the host name or IP address of a NIST time server.

flMessages is a boolean, if true,

flMessages is a boolean, if true then status messages are displayed in the About window.

Action Sends a message according to RFC 868 to the indicated server and retrieves the current time.

Returns The current time.

Errors If there's an error retrieving the time, tcp.getCurrentTime throws a script error which you can trap with a try statement.

Examples tcp.getCurrentTime () //default parameters

   » "10/2/2001; 10:18:12 PM"

tcp.getCurrentTime (server:"utcnist.colorado.edu") //calling a different NIST server

   » "10/2/2001; 10:18:16 PM"

clock.set (tcp.getCurrentTime ()) //set the system clock to the current time

   » true

Notes A list of compatible servers maintained by the US National Institute of Standards (NIST).

NIST docs explaining the format of the date they return.

See also clock.set

Discuss