4.3BSD-Reno/src/bin/date/date.1

Compare this file to the similar file:
Show the results in this format:

.\" Copyright (c) 1980, 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms are permitted provided
.\" that: (1) source distributions retain this entire copyright notice and
.\" comment, and (2) distributions including binaries display the following
.\" acknowledgement:  ``This product includes software developed by the
.\" University of California, Berkeley and its contributors'' in the
.\" documentation or other materials provided with the distribution and in
.\" all advertising materials mentioning features or use of this software.
.\" Neither the name of the University nor the names of its contributors may
.\" be used to endorse or promote products derived from this software without
.\" specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\"     @(#)date.1	6.8 (Berkeley) 7/24/90
.\"
.Dd July 24, 1990
.Dt DATE 1
.Os BSD 4.4
.Sh NAME
.Nm date
.Nd Display or set date and time
.Sh SYNOPSIS
.Nm date
.Op Fl nu
.Op Fl d Ar dst
.Op Fl t Ar minutes_west
.Op yymmddhhmm [\&.ss]
.Sh DESCRIPTION
.Nm Date
displays today's date and time when invoked without
arguments.  Providing an argument will set the desired date;
only the superuser can set the date.
.Pp
Options are:
.Pp
.Tw Ds
.Tp Fl d
Set the kernel's values for daylight savings time.
If
.Ar dst
is non-zero, future calls
to
.Xr gettimeofday 2
will return a non-zero
.Ql tz_dsttime  .
.Tp Fl t
Set the kernel's values for minutes west of GMT.
.Ar Minutes_west
provides the number of minutes returned by future calls to
.Xr gettimeofday 2
in
.Ql tz_minuteswest  .
.Tp Fl u
Display or set the date in GMT (universal) time.
.Tp
.Pp
The canonical representation for setting the date and time:
.Dw Ds
.Dp Ar yy
Year in abbreviated form (.e.g 89 for 1989).
.Dp Ar mm
Numeric month.
A number from 01 to 12.
.Dp Ar dd
Day, a number from 01 to 31.
.Dp Ar hh
Hour, a number from 00 to 24.
.Dp Ar mm
Minutes, a number from 00 to 60.
.Dp Ar .ss
Seconds, a number from 00 to 60.
.Dp
The command:
.Pp
.Dl date 8506131627
.Pp
sets the date to June 13 1985, 4:27 PM.
.Pp
To reset today's time, the incantation can be shortened
to just the hours and minutes:
.Pp
.Dl date 1432
.Pp
sets the time to 2:32 PM, unaffecting the date.
.Pp
Providing a system stays running, date will handle
time changes for daylight/standards savings time and leap times.
.Pp
If
.Xr timed 8
is running to synchronize the clocks of machines in a local
area network,
.Nm date
sets the time globally on all those
machines unless the
.Fl n
option is given.
.Sh FILES
.Dw /var/log/messages
.Di L
.Dp Pa /var/log/wtmp
A record of date resets and time changes.
.Dp Pa /var/log/messages
A record of the name of the user
setting the time.
.Sh SEE ALSO
.Xr gettimeofday 2 ,
.Xr utmp 5 ,
.Xr timed 8
.br
.Em TSP:\ The\ Time\ Synchronization Protocol
.Em for UNIX 4.3BSD ,
R. Gusella
and\ S.\ Zatti
.Sh HISTORY
.Nm Date
appeared in Version 6 AT&T UNIX.
.Sh DIAGNOSTICS
Exit status is 0 on success, 1 on complete failure to set the date,
and 2 on successfully setting the local date but failing globally.
.Pp
Occasionally, when
.Xr timed
synchronizes the time on many hosts,
the setting of a new time value may require more than a few seconds.
On these occasions,
.Nm date
prints: `Network time being set'.
The message `Communication error with timed' occurs when the communication
between
.Nm date
and
.Xr timed
fails.
.Sh BUGS
The system attempts to keep the date in a format closely compatible
with VMS.  VMS, however, uses local time (rather than GMT) and does
not understand daylight-saving time.  Thus, if you use both UNIX
and VMS, VMS will be running on GMT.