File: rdate.8

package info (click to toggle)
rdate 1%3A1.11-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 196 kB
  • sloc: ansic: 705; makefile: 32; sh: 28
file content (120 lines) | stat: -rw-r--r-- 3,600 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
.\" Text automatically generated by txt2man
.TH rdate 8 "14 Feb 2022" "rdate-1.11" "set the system's date from a remote host"
.SH NAME
\fBrdate \fP- set the system's date from a remote host
\fB
.SH SYNOPSIS
.nf
.fam C
\fBrdate\fP [\fB-46acnpsuv\fP] [\fB-b\fP \fIsec\fP] [\fB-o\fP \fIport\fP] [\fB-t\fP \fImsec\fP] \fIhost\fP

.fam T
.fi
.fam T
.fi
.SH DESCRIPTION
\fBrdate\fP displays and sets the local date and time from the \fIhost\fP name or address given as the argument.
The time source may be an RFC 868 TCP protocol server, which is usually implemented as a built-in
service of \fBinetd\fP(8), or an RFC 5905 protocol SNTP/NTP server. By default, \fBrdate\fP uses the RFC 868 TCP
protocol.
.PP
OpenRdate supports IPv4 and IPv6 protocols.
.SH OPTIONS
.TP
.B
\fB-4\fP
Force \fBrdate\fP to use IPv4 addresses only.
.TP
.B
\fB-6\fP
Force \fBrdate\fP to use IPv6 addresses only.
.TP
.B
\fB-a\fP
Use the \fBadjtime\fP(2) call to gradually skew the local time to the remote time rather than just
hopping.
.TP
.B
\fB-b\fP \fIsec\fP
Use adjtime if clock difference is at most \fIsec\fP seconds or hop if difference is greater. This
is the same as including of removing the option \fB-a\fP, based on clock difference.
.TP
.B
\fB-c\fP
Correct leap seconds. Sometimes required when synchronizing to an NTP server. When synchronizing
using the RFC 868 protocol, use this option only if the server does not correctly account for leap
seconds. You can determine if you need this parameter if you sync against an NTP server (with this
parameter) or (recommended) check with a local radio controlled watch or phone service.
.TP
.B
\fB-n\fP
Use SNTP (old RFC 2030, currently RFC 5905) instead of the RFC 868 time protocol. SNTP will always
use UDP protocol and its default \fIport\fP is 123.
.TP
.B
\fB-o\fP \fIport\fP
Use \fIport\fP '\fIport\fP' instead of \fIport\fP 37 (RFC 868) or 123 (SNTP, RFC 5905).
.TP
.B
\fB-p\fP
Do not set, just print the remote time.
.TP
.B
\fB-s\fP
Do not print the time.
.TP
.B
\fB-u\fP
Use UDP instead of TCP as transport (for RFC 868 only; see \fB-n\fP option).
.TP
.B
\fB-t\fP \fImsec\fP
Does not set time if it took more than \fImsec\fP milliseconds to fetch time from network.
.TP
.B
\fB-v\fP
Verbose output. Always show the adjustment.
.SH FILES
.TP
.B
/var/log/wtmp
Record of date resets and time changes.
.SH EXAMPLES
To get the legal time in Germany, set the /etc/localtime symlink
to /usr/share/zoneinfo/right/Europe/Berlin and issue the following command:
.PP
.nf
.fam C
    # rdate -ncv ptbtime1.ptb.de

.fam T
.fi
The command of course assumes you have a working internet connection and DNS set up to connect
to the server at Physikalisch-Technische Bundesanstalt in Braunschweig, Germany.
.PP
To gradually adjust time once an hour after the first "step" adjustment, put the following line
into root's crontab:
.PP
.nf
.fam C
    58  *  *  *  *  rdate -ncav ptbtime1.ptb.de | logger -t NTP

.fam T
.fi
To set the time through an ssh tunnel, use something like so:
.PP
.nf
.fam C
    ssh -f -L 10037:time.example.com:37 tyr.example.com sleep 10
    rdate -a -o 10037 localhost

.fam T
.fi
.SH SEE ALSO
\fBdate\fP(1), \fBadjtime\fP(2), \fBinetd\fP(8), \fBntpd\fP(8), \fBntpdate\fP(8), \fBtimed\fP(8)
.SH AUTHORS
OpenRdate was originally developed by David Snyder and was based in \fBrdate\fP, created by Christos Zoulas
in 1994 for OpenBSD Project. Over time, OpenRdate got several contributions from people.
.PP
This manual page was written by Christos Zoulas. It was changed by Anibal Monsalve Salazar for
the Debian Project and updated by Joao Eriberto Mota Filho.