[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 5


setclock Command

Purpose

Sets the time and date for a host on a network.

Syntax

/usr/sbin/setclockTimeServer ]

Description

The /usr/sbin/setclock command gets the time from a network time server, and if run by a user with root user authority, sets the local time and date accordingly.

The setclock command takes the first response from the time server, converts the calendar clock reading found there, and displays the local date and time. If the setclock command is run by the root user, it calls the standard workstation entry points to set the system date and time.

If no time server responds or if the network is not operational, the setclock command displays a message to that effect and leaves the current date and time settings of the system unchanged.

Note: Any host running the inetd daemon can act as a time server.

Parameter


TimeServer The host name or address of a network host that services TIME requests. The setclock command sends an Internet TIME service request to a time server host. If the TimeServer name is omitted, the setclock command sends the request to the default time server. The default time server in a DOMAIN environment is specified by the name server. Otherwise the default time server is specified in the /etc/hosts file.

Examples

  1. To display the date and time using the time server host specified in the /etc/hosts file, enter:

    setclock
    Sat Mar 11 15:31:05 1988
    

    The setclock command displays the proper date and time.

  2. To set the date and time, enter:

    su root
    setclock host1
    Thu Jan 12 15:24:15 1990
    

    You must use the su command or log in as the root user before setting the time from the time server in host1.

Related Information

The timedc command.

The inetd daemon, timed daemon.

The hosts file format.

TCP/IP Daemons in AIX 5L Version 5.1 System Management Guide: Communications and Networks.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]