View | Details | Raw Unified | Return to bug 18880
Collapse All | Expand All

(-)date/date.1 (-57 / +60 lines)
Lines 61-83 Link Here
61
.Oc
61
.Oc
62
.Op Cm + Ns Ar format
62
.Op Cm + Ns Ar format
63
.Sh DESCRIPTION
63
.Sh DESCRIPTION
64
.Nm Date
64
When invoked without arguments, the
65
displays the current date and time when invoked without arguments.
65
.Nm
66
Providing arguments will format the date and time in a user-defined
66
utility displays the current date and time.
67
way or set the date.
67
Otherwise, depending on the options specified,
68
.Nm
69
will set the date and time or print it in a user-defined way.
70
.Pp
68
Only the superuser may set the date.
71
Only the superuser may set the date.
69
.Pp
72
.Pp
70
The options are as follows:
73
The options are as follows:
71
.Bl -tag -width Ds
74
.Bl -tag -width Ds
72
.It Fl d
75
.It Fl d Ar dst
73
Set the kernel's value for daylight savings time.
76
Set the system's value for daylight saving time.
74
If
77
If
75
.Ar dst
78
.Ar dst
76
is non-zero, future calls
79
is non-zero, future calls
77
to
80
to
78
.Xr gettimeofday 2
81
.Xr gettimeofday 2
79
will return a non-zero
82
will return a non-zero value for
80
.Ql tz_dsttime  .
83
.Fa tz_dsttime .
81
.It Fl f
84
.It Fl f
82
Use
85
Use
83
.Ar fmt
86
.Ar fmt
Lines 89-118 Link Here
89
.Oc "\&yy" Oc "\&mm" Oc "\&dd" Oc "\&HH" Ns
92
.Oc "\&yy" Oc "\&mm" Oc "\&dd" Oc "\&HH" Ns
90
.Oc
93
.Oc
91
.No "\&MM" Ns Op "\&.ss" Xc
94
.No "\&MM" Ns Op "\&.ss" Xc
92
format.  Parsing is done using
95
format.
96
Parsing is done using
93
.Xr strptime 3 .
97
.Xr strptime 3 .
94
.It Fl j
98
.It Fl j
95
Do not try to set the date.  This allows you to use the
99
Do not try to set the date.
100
This allows you to use the
96
.Fl f
101
.Fl f
97
flag in addition to the
102
flag in addition to the
98
.Cm +
103
.Cm +
99
option to convert one date format to another.
104
option to convert one date format to another.
100
.It Fl n
105
.It Fl n
101
The utility
106
By default,
107
if the
102
.Xr timed 8
108
.Xr timed 8
103
is used to synchronize the clocks on groups of machines.
109
daemon is running,
104
By default, if
105
.Xr timed
106
is running,
107
.Nm
110
.Nm
108
will set the time on all of the machines in the local group.
111
sets the time on all of the machines in the local group.
109
The
112
The
110
.Fl n
113
.Fl n
111
option stops
114
option suppresses this behavior and causes the time to be set only on the
112
.Nm
115
current machine.
113
from setting the time for other than the current machine.
116
.It Fl r Ar seconds
114
.It Fl r
117
Print out (in specified format) the date and time represented by
115
Print out the date and time that is
116
.Ar seconds
118
.Ar seconds
117
from the Epoch
119
from the Epoch
118
.Po
120
.Po
Lines 120-138 Link Here
120
see
122
see
121
.Xr time 3
123
.Xr time 3
122
.Pc .
124
.Pc .
123
.It Fl t
125
.It Fl t Ar minutes_west
124
Set the kernel's value for minutes west of
126
Set the system's value for minutes west of
125
.Tn GMT .
127
.Tn GMT .
126
.Ar Minutes_west
128
.Ar minutes_west
127
specifies the number of minutes returned in
129
specifies the number of minutes returned in
128
.Ql tz_minuteswest  
130
.Fa tz_minuteswest
129
by future calls to
131
by future calls to
130
.Xr gettimeofday 2 .
132
.Xr gettimeofday 2 .
131
.It Fl u
133
.It Fl u
132
Display or set the date in
134
Display or set the date in
133
.Tn UTC
135
.Tn UTC
134
.Pq universal
136
(Coordinated Universal) time.
135
time.
136
.It Fl v
137
.It Fl v
137
Adjust the second, minute, hour, month day, week day, month or year according to
138
Adjust the second, minute, hour, month day, week day, month or year according to
138
.Ar val .  
139
.Ar val .  
Lines 140-147 Link Here
140
.Ar val
141
.Ar val
141
is preceded with a plus or minus sign, the date is adjusted forwards
142
is preceded with a plus or minus sign, the date is adjusted forwards
142
or backwards according to the remaining string, otherwise the relevant
143
or backwards according to the remaining string, otherwise the relevant
143
part of the date is set.  The date can be adjusted as many times as
144
part of the date is set.
144
required using these flags.  Flags are processed in the order given.
145
The date can be adjusted as many times as required using these flags.
146
Flags are processed in the order given.
145
.Pp
147
.Pp
146
When setting values
148
When setting values
147
.Pq rather than adjusting them ,
149
.Pq rather than adjusting them ,
Lines 167-184 Link Here
167
must be used to specify which part of the date is to be adjusted.
169
must be used to specify which part of the date is to be adjusted.
168
.Pp
170
.Pp
169
The week day or month may be specified using a name rather than a
171
The week day or month may be specified using a name rather than a
170
number.  If a name is used with the plus
172
number.
173
If a name is used with the plus
171
.Pq or minus
174
.Pq or minus
172
sign, the date will be put forwards
175
sign, the date will be put forwards
173
.Pq or backwards
176
.Pq or backwards
174
to the next
177
to the next
175
.Pq previous
178
.Pq previous
176
date that matches the given week day or month.  This will not adjust the date
179
date that matches the given week day or month.
180
This will not adjust the date
177
if the given week day or month is the same as the current one.
181
if the given week day or month is the same as the current one.
178
.Pp
182
.Pp
179
When a date is adjusted to a specific value or in units greater than hours,
183
When a date is adjusted to a specific value or in units greater than hours,
180
daylight savings time considerations are ignored.
184
daylight saving time considerations are ignored.
181
Adjustments in units of hours or less honour daylight savings time.
185
Adjustments in units of hours or less honor daylight saving time.
182
So, assuming the current date is March 26, 0:30 and that the DST adjustment
186
So, assuming the current date is March 26, 0:30 and that the DST adjustment
183
means that the clock goes forward at 01:00 to 02:00, using
187
means that the clock goes forward at 01:00 to 02:00, using
184
.Fl v No +1H
188
.Fl v No +1H
Lines 200-213 Link Here
200
Refer to the examples below for further details.
204
Refer to the examples below for further details.
201
.El
205
.El
202
.Pp
206
.Pp
203
An operand with a leading plus
207
An operand with a leading plus sign
204
.Pq Dq \&+
208
.Pq Sq +
205
sign signals a user-defined format string which specifies the format in
209
signals a user-defined format
206
which to display the date and time.  The format string may contain any of
210
string which specifies the format in which to display the date and time.
207
the conversion specifications described in the 
211
The format string may contain any of the conversion specifications described
212
in the
208
.Xr strftime 3
213
.Xr strftime 3
209
manual page, as well as any arbitrary text.
214
manual page, as well as any arbitrary text.
210
A <newline> character is always output after the characters specified by
215
A newline
216
.Pq Ql \en
217
character is always output after the characters specified by
211
the format string.
218
the format string.
212
The format string for the default display is
219
The format string for the default display is
213
.Dq +%+ .
220
.Dq +%+ .
Lines 225-247 Link Here
225
Year in abbreviated form
232
Year in abbreviated form
226
.Pq e.g. 89 for 1989, 06 for 2006 .
233
.Pq e.g. 89 for 1989, 06 for 2006 .
227
.It Ar mm
234
.It Ar mm
228
Numeric month.
235
Numeric month, a number from 1 to 12.
229
A number from 1 to 12.
230
.It Ar dd
236
.It Ar dd
231
Day, a number from 1 to 31.
237
Day, a number from 1 to 31.
232
.It Ar HH
238
.It Ar HH
233
Hour, a number from 0 to 23.
239
Hour, a number from 0 to 23.
234
.It Ar MM
240
.It Ar MM
235
Minutes, a number from 0 to 59.
241
Minutes, a number from 0 to 59.
236
.It Ar .ss
242
.It Ar ss
237
Seconds, a number from 0 to 61
243
Seconds, a number from 0 to 61
238
.Pq 59 plus a maximum of two leap seconds .
244
.Pq 59 plus a maximum of two leap seconds .
239
.El
245
.El
240
.Pp
246
.Pp
241
Everything but the minutes is optional.
247
Everything but the minutes is optional.
242
.Pp
248
.Pp
243
Time changes for Daylight Saving and Standard time and leap seconds
249
Time changes for Daylight Saving Time, standard time, leap seconds,
244
and years are handled automatically.
250
and leap years are handled automatically.
245
.Sh EXAMPLES
251
.Sh EXAMPLES
246
The command:
252
The command:
247
.Bd -literal -offset indent
253
.Bd -literal -offset indent
Lines 305-313 Link Here
305
.Li "2:32 PM" ,
311
.Li "2:32 PM" ,
306
without modifying the date.
312
without modifying the date.
307
.Sh ENVIRONMENT
313
.Sh ENVIRONMENT
308
The execution of
314
The following environment variables affect the execution of
309
.Nm
315
.Nm date :
310
is affected by the following environment variables:
311
.Bl -tag -width Ds
316
.Bl -tag -width Ds
312
.It Ev TZ
317
.It Ev TZ
313
The timezone to use when displaying dates.
318
The timezone to use when displaying dates.
Lines 323-331 Link Here
323
.Sh FILES
328
.Sh FILES
324
.Bl -tag -width /var/log/messages -compact
329
.Bl -tag -width /var/log/messages -compact
325
.It Pa /var/log/wtmp
330
.It Pa /var/log/wtmp
326
a record of date resets and time changes
331
record of date resets and time changes
327
.It Pa /var/log/messages
332
.It Pa /var/log/messages
328
a record of the user setting the time
333
record of the user setting the time
329
.El
334
.El
330
.Sh SEE ALSO
335
.Sh SEE ALSO
331
.Xr gettimeofday 2 ,
336
.Xr gettimeofday 2 ,
Lines 339-369 Link Here
339
.%A S. Zatti
344
.%A S. Zatti
340
.Re
345
.Re
341
.Sh DIAGNOSTICS
346
.Sh DIAGNOSTICS
342
The
347
Exit status is 0 on success, 1 if unable to set the date, and 2
343
.Nm
344
utility exits 0 on success, 1 if unable to set the date, and 2
345
if able to set the local date, but unable to set it globally.
348
if able to set the local date, but unable to set it globally.
346
.Pp
349
.Pp
347
Occasionally, when
350
Occasionally, when
348
.Xr timed
351
.Xr timed 8
349
synchronizes the time on many hosts, the setting of a new time value may
352
synchronizes the time on many hosts, the setting of a new time value may
350
require more than a few seconds.
353
require more than a few seconds.
351
On these occasions,
354
On these occasions,
352
.Nm
355
.Nm
353
prints:
356
prints:
354
.Ql Network time being set .
357
.Dq Network time being set .
355
The message
358
The message
356
.Ql Communication error with timed
359
.Dq Communication error with timed
357
occurs when the communication
360
occurs when the communication
358
between
361
between
359
.Nm
362
.Nm
360
and
363
and
361
.Xr timed
364
.Xr timed 8
362
fails.
365
fails.
363
.Sh STANDARDS
366
.Sh STANDARDS
364
The
367
The
365
.Nm
368
.Nm
366
command is expected to be compatible with
369
utility is expected to be compatible with
367
.St -p1003.2 .
370
.St -p1003.2 .
368
.Sh HISTORY
371
.Sh HISTORY
369
A
372
A

Return to bug 18880