xref: /dragonfly/sbin/adjkerntz/adjkerntz.8 (revision 8af44722)
1.\" Copyright (C) 1993-1998 by Andrey A. Chernov, Moscow, Russia.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD: src/sbin/adjkerntz/adjkerntz.8,v 1.18.2.5 2002/08/21 18:58:00 trhodes Exp $
26.\"
27.Dd April 4, 1996
28.Dt ADJKERNTZ 8
29.Os
30.Sh NAME
31.Nm adjkerntz
32.Nd "adjust local time CMOS clock to reflect time zone changes and keep current timezone offset for the kernel"
33.Sh SYNOPSIS
34.Nm
35.Fl i
36.Nm
37.Fl a Op Fl s
38.Sh DESCRIPTION
39The
40.Nm
41utility maintains the proper relationship between the kernel clock, which
42is always set to UTC, and the CMOS clock, which may be set to local
43time.
44The
45.Nm
46utility also informs the kernel about machine timezone shifts to
47maintain proper timestamps for local time file systems such as the MS-DOS
48file system.
49The main purpose of this thing is not general fixing of
50initially broken MS-DOS file timestamp idea but keeping
51the same timestamps between
52.Dx
53MS-DOS file system
54and MS-DOS operating system installed on the same
55machine.
56If the file
57.Pa /etc/wall_cmos_clock
58exists, it means that CMOS clock keeps local time (MS-DOS and MS-Windows
59compatible mode).
60If that file does not exist, it means that the CMOS clock keeps UTC time.
61The
62.Nm
63utility passes this state to the
64.Va machdep.wall_cmos_clock
65kernel variable.
66.Pp
67Adjustments may be needed at system startup and shutdown, and
68whenever a time zone change occurs.
69To handle these different situations,
70.Nm
71is invoked in two ways:
72.Bl -tag -width 4n
73.It Fl i
74This form handles system startups and shutdowns.
75The
76.Nm
77utility is invoked with this option from
78.Pa /etc/rc
79on entry to multi-user mode, before any other daemons have been started.
80The
81.Nm
82utility puts itself into the background.
83Then, for a local time CMOS clock,
84.Nm
85reads the local time from it
86and sets the kernel clock to the corresponding UTC time.
87The
88.Nm
89utility also stores the local time zone offset into the
90.Va machdep.adjkerntz
91kernel variable, for use by subsequent invocations of
92.Em "'adjkerntz -a'"
93and by local time file systems.
94.Pp
95For a local time CMOS clock
96.Em "'adjkerntz -i'"
97pauses, and remains inactive as a background daemon until it
98receives a
99.Dv SIGTERM .
100The
101.Dv SIGTERM
102will normally be sent by
103.Xr init 8
104when the system leaves multi-user mode (usually, because the system
105is being shut down).
106After receiving the
107.Dv SIGTERM ,
108.Nm
109reads the UTC kernel clock and updates the CMOS clock, if necessary,
110to ensure that it reflects the current local time zone.
111Then
112.Nm
113exits.
114.It Fl a Op Fl s
115This form is used to update the local time CMOS clock and kernel
116.Va machdep.adjkerntz
117variable when time zone changes occur,
118e.g., when entering or leaving daylight savings time.
119The
120.Nm
121utility uses the kernel clock's UTC time,
122the previously stored
123time zone offset, and the changed time zone rule to
124calculate a new time zone offset.
125It stores the new offset into the
126.Va machdep.adjkerntz
127kernel variable, and updates the wall CMOS clock to the new local time.
128If
129.Em "'adjkerntz -a'"
130was started at a nonexistent time (during a timezone change), it exits
131with a warning diagnostic unless the
132.Fl s
133option was used, in which case
134.Nm
135sleeps 30 minutes and tries again.
136.Pp
137This form should be invoked from root's
138.Xr crontab 5
139every half hour between midnight and 5am, when most modern time
140zone changes occur.
141Warning: don't use the
142.Fl s
143option in a
144.Xr crontab 5
145command line, or multiple
146.Em "'adjkerntz -a'"
147instances could conflict with each other.
148.El
149.Pp
150The
151.Nm
152utility clears the kernel timezone structure and makes the kernel clock run
153in the UTC time zone.
154Super-user privileges are required for all operations.
155.Sh ENVIRONMENT
156.Bl -tag -width Fl
157.It Ev TZ
158Time zone change rule, see
159.Xr tzset 3 ;
160not needed when
161.Xr tzsetup 8
162or
163.Xr zic 8
164is used.
165.El
166.Sh FILES
167.Bl -tag -width /etc/wall_cmos_clock -compact
168.It Pa /etc/localtime
169Current zoneinfo file, see
170.Xr tzsetup 8
171and
172.Xr zic 8 .
173.It Pa /etc/wall_cmos_clock
174Empty file.
175Its presence indicates that the machine's CMOS clock is set to local
176time, while its absence indicates a UTC CMOS clock.
177.El
178.Sh EXIT STATUS
179.Ex -std
180.Sh DIAGNOSTICS
181No diagnostics.
182If an error occurs,
183.Nm
184logs an error message via
185.Xr syslog 3 .
186.Sh SEE ALSO
187.Xr tzset 3 ,
188.Xr crontab 5 ,
189.Xr mount_msdos 8 ,
190.Xr rc 8 ,
191.Xr sysctl 8 ,
192.Xr tzsetup 8 ,
193.Xr zic 8
194.Sh HISTORY
195The
196.Nm
197utility appeared in
198.Fx 1.0 .
199.Sh AUTHORS
200.An Andrey A. Chernov Aq Mt ache@astral.msk.su
201