Quickstart Guide
Introduction RIO Academic RIO Application examples Your first RT app Your first FPGA app
Basic procedures System admin File system I/O monitor System controller architecture Timed loops Inter-process communication RT/Host communication RT/FPGA communication FPGA personalities Interrupts Datalogger (file I/O)
Design flow Simulation Inter-process communication RT/host communication Derived clock domain IP blocks FPGA personality
Get connected Email Web services UDP TCP IP addresses
Site Map
Guides Code examples Procedures Tags LabVIEW block diagram elements Targets Communications All pages
Glossary How to use About
RIO Developer Essentials Guide for Academia
RT code example

Synchronize the system clock to a NIST time source

Synchronize the system clock time based on querying the Internet Time Service (ITS) maintained NIST (National Institute of Standards and Technology): Open a TCP/IP connection to the "Daytime Protocol" port 13, read the 51-character string, parse the string for time and date information, validate the result (look for a server health indicator and a "magic string"), and then adjust the system time.

LabVIEW RT block diagram snippet: Use TCP to read current time from NIST time server, parse and validate the returned string, update the RT system time accordingly

Use cases


Keep in mind

IMPORTANT: Do not run this subVI more frequently than once every 4 seconds or your IP address may be blocked the NIST time server!

LabVIEW block diagram elements

Locate these elements with "Quick Drop" (press Ctrl+Space and start typing the name); click on an icon to see more sample code that uses that element:

TCP Open Connection
TCP Close Connection
TCP Read
Set Time
Date-Time To Seconds
Get Date-Time In Seconds
Scan From String

Example code

Expected results

https://youtu.be/sik0ut08RGc (1:19)

Developer walk-through

https://youtu.be/uA-667Jdqys (3:36)

For more information

  1. NIST Internet Time Service (ITS) (http://www.nist.gov/pml/div688/grp40/its.cfm)
    See the "Daytime Protocol" section for complete details on the returned character string.
  2. NIST Internet Time Servers (http://tf.nist.gov/tf-cgi/servers.cgi)
    A list of available time servers.