world leader in high performance signal processing
Trace: » ntp

Network Time Protocol

There are a many options which exist to set or synchronize clocks between computers over a network, which can use various ports, and has various resolutions.

This page deals with the System Clock only, not the Hardware Clock (i.e. CMOS or Real Time Clock). For info on that, see the rtc section.


Look at your watch/wall clock, set the time.

root:/> date --set=“16:24:30”

No, this isn't a network based option, but is included here for completeness.


The daytime protocol is an Internet protocol defined in RFC 867, which runs over port 13.

rgetz@pinky ~ $ telnet 13
Connected to
Escape character is '^]'.

55111 09-10-07 17:47:43 26 0 0  61.1 UTC(NIST) *
Connection closed by foreign host.

Few firewalls have port 13 open.


The time protocol defined in RFC 868 which is similar to the daytime protocol described above with the exception that the format of the time given by the time server is in “computer readable” format (seconds since midnight on January first 1900) on port 37.

The linux command netdate uses the time protocol.


Since most time protocols require special ports to be open, you can grab the time from a http header, and use almost any web site, connected to any any network (few networks block port 80).

root:/> htpdate -st
Setting 1254212585.000 seconds
Set: Wed Oct  7 18:23:26 2009

htpdate will only have a resolution of ± ½ second (if the network is fast), since the http only returns things with a one second resolution. This may be accurate enough, it may not.

Network Time protocol (NTP)

According to the website, “NTP is a protocol designed to synchronize the clocks of computers over a network. NTP version 3 is an internet draft standard, formalized in RFC 1305. NTP version 4 is a significant revision of the NTP standard, and is the current development version, but has not been formalized in an RFC. Simple NTP (SNTP) version 4 is described in RFC 2030.”

NTP on uClinux

The NTP programs you want to use need to be compiled and loaded on the target (e.g., if you get ntpdate: not found in uClinux running on the target). To use ntpdate you would need to first select Kernel/Library/Defaults Selection → Custom Vendor/User Settings when you run make menuconfig for the uClinux distro. To build ntpdate, you then select Network Applications→ntpdate. Once you run make and finish loading/booting the new image, you should be able to use ntpdate.

To test NTP, we will use the date command. In order for date to get the correct timezone, refer to the timezones page.

Shell session in uClinux running on the target

root:~> date
Thu Jan  1 00:09:10 UTC 1970
root:~> dhcpcd &
root:~> ntpdate
 3 May 16:48:46 ntpdate[31]: step time server offset 1146674354.235282 sec
root:~> date
Wed May  3 16:48:47 UTC 2006

This only sets the system clock, not the hardware clock (RTC). If you want to do that, check out the rtc info.

You may also want to have your Blackfin time synced with a local host instead of an internet host. For this purpose a ntpd daemon must be configured to listen in order to have it behave as a client AND a time server, (refer to manpage ntpd.conf). At the time of activating your own time server, you should let it operate for at least 30-60 minutes. Otherwise ntpdate may fail syncing, due to not trusting yet your server. Try ntpdate -d <yourhost>.

For a tiny introduction, this link may be useful:

More Information

Implementation documentation is provided by Dr. David Mills at the University of Delaware. The copyright for NTP is also provided on his site.


  • ntpdate - sets local date and time using NTP (e.g., ntpdate
  • ntptrace - trace a chain of NTP servers to original source
  • ntpdc - special program to query ntpd about current state and changes
  • ntpq - standard program to query ntpd about current state and changes
  • ntptime - reads precision-time kernel time variables
  • tickadj - sets precision-time kernel time variables


  • ntpd - NTP operating system daemon
  • keygen - generate public and private keys for the NTPv4 authentication and identification schemes
  • ntpdsim - ntpd simulator

Precision Time protocol

Precision Time protocol (PTP) (as defined by the IEEE 1588 standard) provides very precise time coordination of LAN connected computers.

The PTP is a combination of kernel and userspace software. The userspace implementation started at sourceforge, but has moved to git, and is now maintained at:

The documentation for ptpd still can be found on the Sourceforge pages

ADSP-BF518 supports IEEE 1588 hardware stamp. The page ptp describes how to enable hardware stamp on ADSP-BF518 and use ptpd on masters and slaves.