How to Keep Accurate Time on your Computer

Ollie Hancock — September 17, 2007, 5:17 am

Most computers have internal clocks dedicated to maintaining system time. The internal real-time clocks rely on relatively cheap crystal oscillators,

which are very inaccurate. In many cases computer system time can drift by several minutes each day. This article describes various methods of keeping a highly accurate time on your computer. It describes how to utilise Internet time servers, radio and GPS clocks and dedicated NTP server systems.

Internet Time Servers

The Internet utilises the Network Time Protocol, NTP, to disseminate accurate time information to network time clients. NTP has been an important part of the Internet for more than 25 years. The protocol was born through the desire to provide synchronization of time critical procedures throughout the Internet.

Most modern operating systems, including Microsoft Windows 2003, XP, 2000, UNIX and LINUX have the ability to synchronize time with a NTP Time Server. There are a host of Internet based NTP Time Servers that the public can access that can be used to synchronise your computer. Below is a list of popular Internet based public access NTP Server time references:

ptbtime1.ptb.de - German NTP server time reference.

canon.inria.fr - French NTP server time reference.

time.nist.gov - US based NTP server time reference.

clock.isc.org - Canadian NTP server time reference.

ntp.my-inbox.co.uk - UK NTP server time reference.

Microsoft Windows XP has pre-installed SNTP client software that can synchronize time with a NTP server time reference. This is achieved by simply entering the domain name of a NTP Server in the time properties tab. The host computer will then periodically contact the NTP Server and synchronise the system time to the specified NTP reference.

LINUX and UNIX operating systems have the network time protocol software distribution available from the NTP website. The NTP application runs, in background, as a daemon, constantly monitoring specified NTP servers. The NTP daemon application reads a list of NTP servers from a configuration file, ‘ntp.conf’, and periodically synchronizes time. A list of NTP server references is specified with the ‘server’ configuration command thus:

server clock.isc.org # Canadian NTP server time reference

server ntp.my-inbox.co.uk # UK NTP server time reference.

Once configured, the network time protocol daemon can be started, stopped and restarted using the daemon commands: ‘ntpd start’; ‘ntpd stop’ and ‘ntpd restart’.

GPS Clock and Radio Time References

There a number of commercially available GPS clock and radio time references for computers. GPS and radio clocks obtain accurate time from national radio timing references or from the global positioning system. The devices have either serial or USB computer interfaces and provide an accurate timing reference to computers. Software drivers periodically synchronise the system time of the host computer to the received reference time. Often reference clock drivers are available that interface to the NTP daemon to provide your own dedicated NTP server resource.

LF radio time receivers often have the advantage of having the ability to obtain a signal, indoors. However, the radio signals can only be received locally to the reference transmitter. There are a number of world-wide radio time broadcasts available: WWVB transmitted from Colorado, USA; CHU, Canada; DCF-77 transmitted from Frankfurt, Germany; MSF transmitted from Rugby, UK and TDF, France. GPS has the advantage of providing a world-wide time and frequency system, however, an externally mounted antenna is required which can be impractical in many cases.

Dedicated NTP Servers

NTP servers are time servers that obtain time from an external timing reference, such as GPS or radio, and provide a network with an accurate time resource. NTP servers are usually rack-mounted devices with an antenna and an LAN connection. The devices obtain accurate time from a radio or GPS timing transmission and maintain an accurate internal time. The accurate time is distributed to network clients using UDP over an IP network. Dedicated NTP servers often minimize the set-up and configuration time required to get a NTP server up and running.

.About the Author:

Dave Evans is a software engineer involved in the development of NTP Server time synchronisation systems. Dave has developed dedicated NTP time server systems, NTP clock and atomic clock synchronisation products. Find out more about SNTP and NTP Server Systems here.

How to Configure a Windows Time Server

Ollie Hancock — July 10, 2007, 8:52 pm

The latest Microsoft Windows operating systems have a time synchronisation utility installed by default called ‘Windows Time’. The Windows

time service allows a Microsoft network to provide time synchronisation of machines in a domain. This article introduces how to configure the Microsoft Windows 2000 and 2003 operating systems to operate as a SNTPNTP Time Server. The article discusses how to change Windows registry entries to configure the Time Service.

Before modifying any Windows registry settings, it is a good idea to save the registry. In the even of any difficulties, the registry can be restored to its former state.

Windows 2000 Time Service

Windows 2000 has an integrated network time synchronization service, installed by default, which can be configured to synchronize to a Time Server. In fact, by changing associated registry settings, the service can act as both a time client and a time server to synchronize other network time clients.

The Windows Time service should be present in the systems service list. The application executable is ‘w32time.exe’. The parameter list for time service should be present in the in the registry at:

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeParameters

The Windows 2000 operating system can operate as a time client and synchronise to a time server by setting the parameter ‘NTP Server’ to the IP address of a Time Server.

By default, the Windows 2000 machine will synchronize to the specified time server every 8 hours, or 3 times a day. This may not be enough to maintain accurate synchronization and can be easily increased. Setting the ‘Period’ parameter to how many times each day synchronisation is required can reduce the period. Setting the ‘Period’ parameter to 48 will activate synchronization with the time server once every half hour.

The Windows 2000 operating system can also be configured to act as a time server by setting the ‘Local NTP’ registry setting to ‘1′.

After changing any of the registry settings for the windows time service, the service must be restarted for the settings to take effect. The time service can be started or stopped from the service control applet in the Administrative Tools menu. The service can also be controlled via the DOS net command thus:

‘net start w32time’ and ‘net stop w32time’

Windows 2003 Time Service

With Windows 2003, Microsoft has expanded on the original Windows 2000 SNTP time service by providing a true NTP implementation. The Windows 2003 time service, installed by default, can synchronise to a NTP Server. Indeed, by changing registry settings, the time service can act as both a time server and client to synchronize other time clients in the domain.

The ‘Windows Time’ service should be present in the systems service list. The application executable is ‘w32time.exe’. The parameter list for the Windows 2003 time service should be present in the registry at:

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32Time

To configure the Windows 2003 operating system to synchronize to an external time server, edit the following registry entries:

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeParametersType

Set the ‘Type’ registry entry to ‘NTP’, which specifies synchronization to a NTP time server.

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeTimeProvidersNTPClientSpecialPollInterval

The ‘Special Poll Interval’ registry entry defines the period in seconds that the Windows 2003 operating system should poll the time server. A recommended value is 900, which equates to a polling period of every 15 minutes.

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeConfigAnnounceFlags

Set the ‘Announce Flags’ registry entry to 5 indicating a reliable time reference.

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeTimeProvidersNTPServerEnabled

Changing the ‘Enabled’ flag to the value 1 enables the NTP Time Server.

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeParametersNtpServer

The ‘NTP Server’ parameter is used to provide a list of DNS names or IP addresses, separated by a space, of time servers that the Windows 2003 operating system can synchronize to.

Troubleshooting the Time Service

A number of isuues may be encountered when configuring the Microsoft Windows Time Service. SNTP and NTP operates using the UDP protocol over TCP/IP. Therefore, the TCP/IP network protocol must be active for SNTPNTP to operate. Synchronisation issues may also arise when SNTPNTP attempts to synchronise to an inaccurate time server reference or if network delays are excessive.

Synchronising Network Device and Components

In addition to synchronizing Microsoft Windows servers and workstations, time servers can also be used to synchronise network devices, such as switches, routers and hubs. Any network infrastructure that can synchronise to a NTP or SNTP time server can be pointed to the Windows time server to obtain synchronisation. In this way the whole network and accompanying infrastructure can be accurately synchronised to a time reference.

.About the Author:

D. Evans develops Windows SNTPNTP time server synchronisation solutions that ensure accurate time on PC’s and networks. Dave has been heavily involved in the development of dedicated Windows time server systems, NTP synchronized digital clock systems and atomic clock synchronization products. Click here to find out more about Windows Time Server solutions.

How to Configure a Linux Ntp Server

Ollie Hancock — July 8, 2007, 1:37 pm

Network Time Protocol (NTP) provides algorithms and defines messages for the synchronisation of time clients to an accurate time reference. This article

discusses how to configure a Linux NTP Time Server to synchronise time with an Internet based public NTP Server.

NTP server systems fall into two categories: primary reference servers and secondary reference servers. Primary reference servers use an external timing reference to provide time, such as GPS or radio clocks. Secondary reference servers synchronise with primary reference NTP servers and offer slightly reduced accuracy. Primary reference servers are designated stratum 1 servers, while secondary servers have a stratum greater than 1.

The NTP Distribution

The NTP source code is freely available from the Network Time Protocol web site. The current version available for download is 4.2.4. NTP is available for the Linux operating systems with ports available for Windows NT. Once the source code is downloaded, it should be configured, compiled and installed on the host machine. Many Linux operating systems, such as RedHat, offer NTP RPM packages.

Configuring NTP

The ‘ntp.conf’ file is main source of configuration information for a NTP server installation. Amongst other things, it contains a list of reference clocks that the installation is to synchronise. A list of NTP server references is specified with the ‘server’ configuration command thus:

server time-a.nist.gov # NIST, Gaithersburg, Maryland NTP server

server time-c.timefreq.bldrdoc.gov # NIST, Boulder, Colorado NTP server

Controlling the NTP Server Daemon

Once configured, the NTP daemon can be started, stopped and restarted using the commands: ‘ntpd start’; ‘ntpd stop’ and ‘ntpd restart’. The NTP server daemon can be queried using the ‘ntpq –p’ command. The ntpq command queries the NTP server for synchronisation status and provides a list of servers with synchronisation information for each server.

NTP Access Control

Access to the NTP server can be restricted using the ‘restrict’ directive in the ntp.conf file. You can restrict all access to the NTP server with:

restrict default ignore

To only allow machines on your own network to synchronize with the server use:

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

Multiple restrict directives can be specified in the ntp.conf file to restrict access to a specified range of computers.

Authentication Options

Authentication allows a matching passwords to be specified by the NTP server and associated clients. NTP keys are stored in the ntp.keys file in the following format: Key-number M Key (The M stands for MD5 encryption), e.g.:

1 M secret

5 M RaBBit

7 M TiMeLy

10 M MYKEY

In the NTP configuration file ntp.conf, specify which of the keys specified above are trusted, i.e. are secure and you want to use. Any keys specified in the keys file but not trusted will not be used for authentication, e.g.:

trustedkey 1 7 10

The NTP server is now configured for authentication.

Client Configuration for Authentication

The client needs to be configured with similar information as the server, however, you may use a subset of the keys specified on the server. A different subset of keys can be used on different clients, e.g.:

Client A)

1 M secret

7 M TiMeLy

trustedkey 1 7

Client B)

1 M secret

5 M RaBBit

7 M TiMeLy

10 M MYKEY

trustedkey 7 10

Essentially authentication is used by the client to authenticate that the time server is who he says he is, and that no rogue server intervenes. The key is encrypted and sent to the client by the server where it is unencrypted and checked against the client keys to ensure a match.

.About the Author:

Dave Evans develops Linux NTP Server synchronisation systems to ensure accurate time on PC’s and computer networks. Click here to find out more about Linux NTP Time Server systems.


Recent posts on BlogLion:

What Does the Eye Tell Us About Evolution ( 2008-11-21 11:24:10 )

Why the Shiftless Man Goes Hungry in Bible and Quran? ( 2008-11-21 06:24:01 )

How To Improve Your Results With These Bass Fishing Tips! ( 2008-11-20 08:01:58 )

Refurbished Canon Digital Camera: Quality Cameras for Less Money ( 2008-11-19 02:22:24 )


Previous blog: Iva
Next blog: Allie Boy