## TCPware V5.7 Management Guide

- Introduction
- Time Synchronization
  - Primary Candidate Election Process
  - TIMED Operation Mode
  - Changing Network Time
- Setting TIMED Parameters
  - Loadable Timezone Rules
    - Format of COUNTRY Specification
    - Format of ZONE Specification
    - Format of RULE Specification
  - Loadable Timezone Rules Provided with TCPware
- TIMEDC Command Reference
  - Examples

Chapter 11

TIMED

# Introduction

This chapter describes how to manage TIMED, the time daemon, otherwise known as the Time Synchronization Protocol (TSP). TIMED synchronizes the clocks of the various hosts in a LAN. The synchronization process is totally transparent to system or network users.

The timed program (or daemon) uses the Time Synchronization Protocol (TSP) to synchronize the clocks of LAN hosts. TSP was originally based on UNIX 4.3BSD systems, but is available for all systems connected by TCPware for OpenVMS.

TIMED provides:

• Synchronization of host clocks

• Election of primary candidates if the primary disappears

# Time Synchronization

TIMED synchronizes clocks through an algorithm that slows some clocks and speeds up others to create an average network time. Each host must support a time daemon. The timed daemon depends on a primary/dependent relationship. The primary time daemon measures the difference between clocks using broadcast ICMP timestamp requests and computes the network time based on the average of all replies. It then sends the dependent time daemons the corrections they should make to their clocks. Synchronization can occur to within 20 milliseconds.

This process repeats periodically. If host clocks drift away from each other, the process again synchronizes them based on the average. Because corrections depend on time differences rather than absolute time, transmission delays have no effect on synchronization.

When a new dependent host joins the network, its time daemon immediately resets its clock based on that of the primary time server. In the case of a fixed primary, no averaging takes place and each negotiating dependent accepts the absolute time of the primary host.

The timed daemon interacts with the date command to set the date globally. You can also use the TIMEDC command to determine the status of a time daemon (see TIMEDC Command Reference).

Figure 11-1 shows a typical time synchronization transaction, as follows:

1 When a dependent host initially starts TIMED, it requests the network time from the primary host and adjusts its time accordingly.

2 The primary broadcasts messages to solicit the names of active dependents, which reply.

3 The primary sends an "adjust time" message to each dependent with the difference between the dependent timestamp and the computed average time.

4 Each dependent sends back an acknowledgment.

Figure 11-1 T ime Synchronization Transaction Using TSP see graphic

## Primary Candidate Election Process

Dependent hosts also need to elect among themselves candidates for a new primary should the current one go down. This occurs through an election algorithm, as follows:

1 When a dependent's election timer expires, it broadcasts an "election" message declaring that it wants to become the new primary. The dependent becomes a primary candidate.

2 If no other dependent was accepted as primary candidate, each of the other dependents responds with an "accept" message to the election request and rejects any other candidates.

3 The primary candidate adds each accepting dependent's name to its list.

4 If the current primary goes down, the elected candidate becomes the new primary.

## T IMED Operation Mode

You can start TIMED in one of the following three modes:

Mode | Description
Dependent | The host joins the time synchronization if it finds a primary daemon on the network. It never operates as a primary.
Primary candidate | If the host finds a primary daemon on the network, it operates as a dependent daemon. If it does not find a primary daemon, it initiates a primary election process, and if granted, becomes a primary if the primary server goes down. There can be multiple TIMED hosts started in primary candidate mode.
Fixed primary | The host starts as a primary server or receives an error if it detects another primary. A fixed primary adjusts other hosts to its host time. It does not average the network time and never adjusts its own time. All other hosts must run as dependents.

You can synchronize the clock of the host running a fixed primary with other reliable sources using different clock synchronization. For example, you can run the Network Time Protocol (NTP) daemon to synchronize the fixed primary host to reliable sources on the Internet.

See Chapter 10, Network Time Protocol (NTP), for details on NTP.

## Changing Network Time

When TIMED synchronizes the clocks on multiple hosts, changing time on one machine using the OpenVMS SET TIME command does not achieve the desired effect unless the host for which you change the time is a fixed primary.

To adjust the time of all hosts synchronized by TIMED, use the DATE option in the TIMEDC command (see TIMEDC Command Reference). If there are UNIX hosts synchronized with TIMED, the UNIX date command adjusts the network time.

# Setting TIMED Parameters

The timed daemon starts up automatically enabled during TCPware configuration. You can set certain parameters on startup through TCPware logicals. See the following table:

Logical | Description
TCPWARE_TIMED_MODE | Determines if the current host is a MASTER (primary), FIXED MASTER (fixed primary), or SLAVE (dependent) MASTER (primary)broadcasts time synchronization requests, calculates the time differences and averages, and sends "adjust time" messages. FIXED MASTER (fixed primary)provides absolute time stamps to newly started dependent TIMED hosts. SLAVE (dependent)is the recipient of primary "adjust time" messages.
q | Determines the networks included in clock synchronization, either in network addresses or names
TCPWARE_TIMED_EXCLUDE | Determines the networks excluded from clock synchronization, either in network addresses or names

## Loadable Timezone Rules

Loadable timezone rules provided with TCPware are in the text file TCPWARE:TIMEZONES.DAT. You can add user-written timezone rules to the file TCPWARE:TIMEZONES.LOCAL to override the zones in TIMEZONES.DAT. Loadable timezone rules consist of three parts:

COUNTRY | Is a collection of timezones (ZONEs). For example, the country US selects all U.S. timezones. This provides a convenient way to select groups of timezones.
ZONE | Is a specification of a particular timezone, including the name of the zone, the GMT offset, the DST rules in effect, and the name to use while DST is in effect.
RULE | Is a rule for determining when DST is in effect.

### Format of COUNTRY Specification

COUNTRY countryname zonename [zonename . . .]

The COUNTRY specification gives the name of a geographical area and the names of the timezones associated with it. This provides a way to group timezones so they may be selected more conveniently.

The following example shows the definition of the country "US" listing the zones corresponding to the United States. The example for Arizona is slightly different, showing the zone "US/Arizona" instead of "US/Mountain." ("US/Arizona" is the definition of a Mountain timezone that does not observe Daylight Savings Time.)

Country US US/Eastern US/Central US/Mountain US/Pacific US/Yukon
US/Hawaii

Country US/Arizona -

US/Eastern US/Central US/Arizona US/Pacific US/Yukon US/Hawaii

### Format of ZONE Specification

ZONE zonename gmtoffset rulename standar

zonename | Is the name by which this zone can be selected, or the name by which it is referred to in a COUNTRY specification.
gmtoffset | Is this zone's standard time offset from GMT.
rulename | Is the name of the RULE specification that determines when DST is in effect for this zone. The rulename may be an underscore (_) to indicate that this zone does not use DST.
standard-name and dst-name | Are the names by which this zone is referred to during standard time, and during Daylight Savings Time, respectively. These are the names by which SET TIMEZONE selects the local timezone.

d-name dst-name [COMPILED_IN]

The ZONE specification describes a timezone:

If there are no DST rules, the dst-name should be specified as an underscore (_). The optional COMPILED_IN keyword indicates that this rule is compiled-in and need not be loaded, as long as no other rules conflict with it. If you edit a COMPILED_IN ZONE specification, you must remove the COMPILED_IN keyword to force the ZONE specification to be loaded.

The following example shows the definition of the normal United States Mountain timezone. The Arizona example shows the definition of a Mountain timezone that does not observe Daylight Savings Time.

Zone US/Mountain -7:00 US MST MDT COMPILED_IN
Zone US/Arizona -7:00 _ MST

### Format of RULE Specification

RULE rulename startyear ruletype save start-date end-date

The RULE specification describes a set of rules for determining at what times DST is in effect:

rulename | Is the name of the RULE specification in ZONE specifications.
startyear | Is the year during which this DST rule takes effect. The rule remains in effect until a later startyear is specified in a rule with the name rulename.
ruletype | Specifies the type of DST rules. There are three permitted values: • DST indicates normal Northern-Hemisphere Daylight Savings Time rules, which switch at the time and date indicated. • REV_DST indicates normal Southern-Hemisphere Daylight Savings Time rules. NULL indicates that no Daylight Savings Time is in effect during the specified years.
save | Indicates the difference between Standard Time and DST.
start-date and end-date | Specify the starting and ending dates for DST. Specific dates can be specified, or rules such as "First Sunday" or "Last Sunday" can be used. See the file TCPWARE:TIMEZONES.DAT for examples on specifying dates.

The following example illustrates the United States

Federal Daylight Savings Time rules:

Rule US 1987 DST 1:00 First Sunday April 2:00 Last Sunday October 2:00
Rule US 1976 DST 1:00 Last Sunday April 2:00 Last Sunday October 2:00
Rule US 1975 DST 1:00 23 February 2:00 Last Sunday October 2:00
Rule US 1974 DST 1:00 6 January 2:00 Last Sunday October 2:00
Rule US 1970 DST 1:00 Last Sunday April 2:00 Last Sunday October 2:00

## Loadable Timezone Rules Provided with TCPware

Table 11-1 shows the loadable rules provided in the TCPWARE:TIMEZONES.DAT file which you may modify or augment as appropriate for your location.

Table 11-1 Loadable Timezone Rules (Continued)

Country Name | Rule Name | Timezone Name | GMT Offset | DST Rules
| GMT | GMT | 0 hours | -none-
| UT | UTa | 0 hours | -none-
US-Military | US-Military/Za | Z | 0 hours | -none-
US-Military | US-Military/Aa | A | -1 hour | -none-
US-Military | US-Military/Ba | B | -2 hours | -none-
US-Military | US-Military/Ca | C | -3 hours | -none-
US-Military | US-Military/Da | D | -4 hours | -none-
US-Military | US-Military/Ea | E | -5 hours | -none-
US-Military | US-Military/Fa | F | -6 hours | -none-
US-Military | US-Military/Ga | G | -7 hours | -none-
US-Military | US-Military/Ha | H | -8 hours | -none-
US-Military | US-Military/Ia | I | -9 hours | -none-
US-Military | US-Military/Ka | K | -10 hours | -none-
US-Military | US-Military/La | L | -11 hours | -none-
US-Military | US-Military/Ma | M | -12 hours | -none-
US-Military | US-Military/Na | N | 1 hour | -none-
US-Military | US-Military/Oa | O | 2 hours | -none-
US-Military | US-Military/Pa | P | 3 hours | -none-
US-Military | US-Military/Qa | Q | 4 hours | -none-
US-Military | US-Military/Ra | R | 5 hours | -none-
US-Military | US-Military/Sa | S | 6 hours | -none-
US-Military | US-Military/Ta | T | 7 hours | -none-
US-Military | US-Military/Ua | U | 8 hours | -none-
US-Military | US-Military/Va | V | 9 hours | -none-
US-Military | US-Military/Wa | W | 10 hours | -none-
US-Military | US-Military/Xa | X | 11 hours | -none-
US-Military | US-Military/Ya | Y | 12 hours | -none-
US | US/Easterna | EST/EDT | -5 hours | US Federal
US | US/Centrala | CST/CDT | -6 hours | US Federal
US | US/Mountaina | MST/MDT | -7 hours | US Federal
US | US/Pacifica | PST/PDT | -8 hours | US Federal
US | US/Yukona | YST/YDT | -9 hours | US Federal
US | US/Hawaiia | HST | -10 hours | -none-
US/East-Indiana | US/East-Indiana | EST | -5 hours | -none-
US/Arizona | US/Arizona | MST | -7 hours | -none-
Canada | Canada/Newfoundlanda | NST/NDT | -3:30 hours | Canadian
Canada | Canada/Atlantica | AST/ADT | -4 hours | Canadian
Canada | Canada/Eastern | EST/EDT | -5 hours | Canadian
Canada | Canada/Central | CST/CDT | -6 hours | Canadian
Canada | Canada/Mountain | MST/MDT | -7 hours | Canadian
Canada | Canada/Pacific | PST/PDT | -8 hours | Canadian
Canada | Canada/Yukon | YST/YDT | -9 hours | Canadian
Canada | Canada/Saskatchewan | CST | -6 hours | -none-
Israel | Israel | IST/DST | +2 hours | Israeli
Australia | Australia/Tasmania | EST | 10 hours | Australian
Australia | Australia/Queensland | EST | 10 hours | -none-
Australia | Australia/North | CST | 9:30 hours | -none-
Australia | Australia/West | WST | 8 hours | -none-
Australia | Australia/South | CST | 9:30 hours | Australian
Australia | Australia/Victoria | CST | 10 hours | Australian
Australia | Australia/NSW | CST | 10 hours | Australian
Australia | Australia/Yarcowinna | CST | 9:30 hours | Australian
Australia | Australia/LHI | CST | 10:30 hours | Australian
Europe | Britaina | GMT/BST | 0 hours | GB-Eire
Europe | Europe/Westerna | WET/WET-DST | 0 hours | W-Eur
Europe | Europe/Middlea | MET/MET-DST | 1 hour | M-Eur
Europe | Europe/Centrala | CET/CET-DST | 1 hour | M-Eur
Europe | Europe/Easterna | EET/EET-DST | 2 hours | E-Eur
| Iceland | GMT | 1 hour | -none-
| Poland | MET | 1 hour | W-Eur
| Turkey | EET/EET/DST | 3 hours | Turkey
Japan | Japana | JST | +9 hours | -none-
Singapore | Singaporea | SST | +8 hours | -none-
NewZealand | NewZealanda | NZST/NZDT | +12 hours | New Zealand

# TIMEDC Command Reference

The TIMEDC command returns information about the timed daemon, such as the time difference between the local clock and that of a specified host or hosts, the location of the primary server, and logged TIMED messages in the TCPWARE:TIMED.LOG file. You can issue this command from any machine running TCPware's TIMED. The following page provides a TIMEDC command reference.

TIMEDC

Returns information about the timed daemon on the local host. You can issue this command from any machine running TCPware's TIMED.

Execute the command on the DCL level.

Format

TIMEDC [option]

The options for the TIMEDC command follow. If you omit the option, you are prompted for it at the timedc> prompt.

Options

HELP ?

Provides online help.

CLOCKDIFF host [host ...]

Computes the difference (in milliseconds) between the clocks of the local and specified host or hosts or IP address or addresses (with multiple entries separated by spaces). Synchronization can occur to within 20 milliseconds.

DATE [yyyy [mm[dd[hh]]]]mm[ss]

Sets the networking time to the specified date and time, in the order year, month, date, hour, minutes, and seconds. Entry requires at least minutes (the remaining values are optional).

MSITE

Finds the location of the primary time server.

TRACE {ON | OFF}

Enables or disables tracing of incoming messages to the timed daemon. The TCPWARE:TIMED.LOG file holds the messages.

QUIT

Quits the TIMEDC command.

## Examples

1 Gives the time difference in milliseconds between HOMER and local host BART.

$ TIMEDC CLOCKDIFF HOMER

time on HOMER.ILLIAD.COM is 124 ms. ahead of time on bart.humor.com

2 Locates the primary timed daemon, which in this case is MARGE.

$ TIMEDC MSITE

master timedaemon at homer.illiad.com is marge.humor.com

3 PENNY is not a TIMED host or its timed process is not running.

$ TIMEDC

timedc> CLOCKDIFF PENNY
penny.clothing.com is down