1998-04-11 21:18:55 +00:00
|
|
|
.\" Copyright (C) 1993-1998 by Andrey A. Chernov, Moscow, Russia.
|
1993-12-16 18:44:40 +00:00
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1997-01-13 00:25:51 +00:00
|
|
|
.\"
|
1996-04-05 23:37:08 +00:00
|
|
|
.Dd April 4, 1996
|
1993-12-16 18:44:40 +00:00
|
|
|
.Dt ADJKERNTZ 8
|
|
|
|
.Os FreeBSD
|
|
|
|
.Sh NAME
|
|
|
|
.Nm adjkerntz
|
1996-04-05 23:37:08 +00:00
|
|
|
.Nd "adjust local time CMOS clock to reflect time zone changes and keep current timezone offset for the kernel"
|
1993-12-16 18:44:40 +00:00
|
|
|
.Sh SYNOPSIS
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1994-11-02 10:04:11 +00:00
|
|
|
.Fl i
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1996-04-05 23:37:08 +00:00
|
|
|
.Fl a Op Fl s
|
1993-12-16 18:44:40 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Nm Adjkerntz
|
1996-04-05 23:37:08 +00:00
|
|
|
maintains the proper relationship between the kernel clock, which
|
|
|
|
is always set to UTC, and the CMOS clock, which may be set to local
|
|
|
|
time.
|
|
|
|
.Nm Adjkerntz
|
1996-04-09 11:31:34 +00:00
|
|
|
also informs the kernel about machine timezone shifts to
|
|
|
|
maintain proper timestamps for local time file systems such as the MS-DOS
|
2000-03-01 11:27:47 +00:00
|
|
|
file system.
|
|
|
|
The main purpose of this thing is not general fixing of
|
1996-04-09 11:31:34 +00:00
|
|
|
initially broken MS-DOS file timestamp idea but keeping
|
1998-06-04 06:35:12 +00:00
|
|
|
the same timestamps between
|
2000-11-14 11:20:58 +00:00
|
|
|
.Fx
|
1998-06-04 06:35:12 +00:00
|
|
|
MS-DOS file system
|
1996-04-09 11:31:34 +00:00
|
|
|
and MS-DOS operating system installed on the same
|
|
|
|
machine.
|
1996-04-05 23:37:08 +00:00
|
|
|
If the file
|
1993-12-16 18:44:40 +00:00
|
|
|
.Pa /etc/wall_cmos_clock
|
1996-04-09 11:31:34 +00:00
|
|
|
exists, it means that CMOS clock keeps local time (MS-DOS and MS-Windows
|
|
|
|
compatible mode).
|
|
|
|
If that file does not exist, it means that the CMOS clock keeps UTC time.
|
1996-04-05 23:53:23 +00:00
|
|
|
.Nm Adjkerntz
|
1996-04-09 11:31:34 +00:00
|
|
|
passes this state to the
|
1996-04-05 23:53:23 +00:00
|
|
|
.Pa machdep.wall_cmos_clock
|
|
|
|
kernel variable.
|
1993-12-16 18:44:40 +00:00
|
|
|
.Pp
|
1996-04-05 23:37:08 +00:00
|
|
|
Adjustments may be needed at system startup and shutdown, and
|
|
|
|
whenever a time zone change occurs.
|
|
|
|
To handle these different situations,
|
1998-06-04 06:35:12 +00:00
|
|
|
.Nm
|
1996-04-05 23:37:08 +00:00
|
|
|
is invoked in two ways:
|
1994-11-02 10:04:11 +00:00
|
|
|
.Bl -tag -width 4n
|
2001-02-28 17:38:53 +00:00
|
|
|
.It Fl i
|
1996-04-05 23:37:08 +00:00
|
|
|
This form handles system startups and shutdowns.
|
|
|
|
.Nm Adjkerntz
|
|
|
|
is invoked with this option from
|
1993-12-16 18:44:40 +00:00
|
|
|
.Pa /etc/rc
|
1996-04-05 23:53:23 +00:00
|
|
|
on entry to multi-user mode, before any other daemons have been started.
|
1993-12-16 18:44:40 +00:00
|
|
|
.Nm Adjkerntz
|
1996-04-05 23:37:08 +00:00
|
|
|
puts itself into the background.
|
1996-04-09 11:31:34 +00:00
|
|
|
Then, for a local time CMOS clock,
|
1998-06-04 06:35:12 +00:00
|
|
|
.Nm
|
1996-04-05 23:53:23 +00:00
|
|
|
reads the local time from it
|
1996-04-05 23:37:08 +00:00
|
|
|
and sets the kernel clock to the corresponding UTC time.
|
|
|
|
.Nm Adjkerntz
|
|
|
|
also stores the local time zone offset into the
|
|
|
|
.Pa machdep.adjkerntz
|
|
|
|
kernel variable, for use by subsequent invocations of
|
1998-06-04 06:35:12 +00:00
|
|
|
.Em "'adjkerntz -a'"
|
1996-04-05 23:53:23 +00:00
|
|
|
and by local time file systems.
|
1996-04-05 23:37:08 +00:00
|
|
|
.Pp
|
1996-04-09 11:31:34 +00:00
|
|
|
For a local time CMOS clock
|
1998-06-04 06:35:12 +00:00
|
|
|
.Em "'adjkerntz -i'"
|
1996-04-05 23:37:08 +00:00
|
|
|
pauses, and remains inactive as a background daemon until it
|
|
|
|
receives a SIGTERM.
|
|
|
|
The SIGTERM will normally be sent by
|
|
|
|
.Xr init 8
|
|
|
|
when the system leaves multi-user mode (usually, because the system
|
|
|
|
is being shut down).
|
|
|
|
After receiving the SIGTERM,
|
1998-06-04 06:35:12 +00:00
|
|
|
.Nm
|
1996-04-05 23:37:08 +00:00
|
|
|
reads the UTC kernel clock and updates the CMOS clock, if necessary,
|
|
|
|
to ensure that it reflects the current local time zone.
|
|
|
|
Then
|
1998-06-04 06:35:12 +00:00
|
|
|
.Nm
|
1996-04-05 23:37:08 +00:00
|
|
|
exits.
|
2001-02-28 17:38:53 +00:00
|
|
|
.It Fl a Op Fl s
|
1996-04-09 11:31:34 +00:00
|
|
|
This form is used to update the local time CMOS clock and kernel
|
1996-04-05 23:37:08 +00:00
|
|
|
.Pa machdep.adjkerntz
|
|
|
|
variable when time zone changes occur,
|
|
|
|
e.g., when entering or leaving daylight savings time.
|
1993-12-16 18:44:40 +00:00
|
|
|
.Nm Adjkerntz
|
1996-04-05 23:37:08 +00:00
|
|
|
uses the kernel clock's UTC time,
|
|
|
|
the previously stored
|
|
|
|
time zone offset, and the changed time zone rule to
|
|
|
|
calculate a new time zone offset.
|
|
|
|
It stores the new offset into the
|
|
|
|
.Pa machdep.adjkerntz
|
|
|
|
kernel variable, and updates the wall CMOS clock to the new local time.
|
|
|
|
If
|
1998-06-04 06:35:12 +00:00
|
|
|
.Em "'adjkerntz -a'"
|
1996-04-09 11:31:34 +00:00
|
|
|
was started at a nonexistent time (during a timezone change), it exits
|
|
|
|
with a warning diagnostic unless the
|
1996-04-05 23:37:08 +00:00
|
|
|
.Fl s
|
1996-04-09 11:31:34 +00:00
|
|
|
option was used, in which case
|
1998-06-04 06:35:12 +00:00
|
|
|
.Nm
|
1996-04-09 11:31:34 +00:00
|
|
|
sleeps 30 minutes and tries again.
|
1996-04-05 23:37:08 +00:00
|
|
|
.Pp
|
|
|
|
This form should be invoked from root's
|
1994-11-02 10:04:11 +00:00
|
|
|
.Xr crontab 5
|
1998-04-11 21:18:55 +00:00
|
|
|
every half hour between midnight and 5am, when most modern time
|
1996-04-05 23:37:08 +00:00
|
|
|
zone changes occur.
|
1996-04-09 11:31:34 +00:00
|
|
|
Warning: don't use the
|
1996-04-05 23:37:08 +00:00
|
|
|
.Fl s
|
1996-04-09 11:31:34 +00:00
|
|
|
option in a
|
1996-04-05 23:37:08 +00:00
|
|
|
.Xr crontab 5
|
1996-04-09 11:31:34 +00:00
|
|
|
command line, or multiple
|
1998-06-04 06:35:12 +00:00
|
|
|
.Em "'adjkerntz -a'"
|
1996-04-09 11:31:34 +00:00
|
|
|
instances could conflict with each other.
|
1994-11-03 03:16:16 +00:00
|
|
|
.El
|
1993-12-16 18:44:40 +00:00
|
|
|
.Pp
|
|
|
|
.Nm Adjkerntz
|
1996-04-05 23:37:08 +00:00
|
|
|
clears the kernel timezone structure and makes the kernel clock run
|
|
|
|
in the UTC time zone.
|
|
|
|
Super-user privileges are required for all operations.
|
1993-12-16 18:44:40 +00:00
|
|
|
.Sh ENVIRONMENT
|
|
|
|
.Bl -tag -width Fl
|
|
|
|
.It Ev TZ
|
|
|
|
Time zone change rule, see
|
|
|
|
.Xr tzset 3 ;
|
|
|
|
not needed when
|
1996-04-07 00:06:21 +00:00
|
|
|
.Xr tzsetup 8
|
1994-11-01 16:22:22 +00:00
|
|
|
or
|
1993-12-16 18:44:40 +00:00
|
|
|
.Xr zic 8
|
|
|
|
is used.
|
2000-12-18 15:16:24 +00:00
|
|
|
.El
|
1993-12-16 18:44:40 +00:00
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -width /etc/wall_cmos_clock -compact
|
|
|
|
.It Pa /etc/localtime
|
1994-11-02 10:04:11 +00:00
|
|
|
Current zoneinfo file, see
|
1996-04-07 00:06:21 +00:00
|
|
|
.Xr tzsetup 8
|
1994-11-01 16:22:22 +00:00
|
|
|
and
|
1993-12-16 18:44:40 +00:00
|
|
|
.Xr zic 8 .
|
|
|
|
.It Pa /etc/wall_cmos_clock
|
|
|
|
Empty file.
|
1996-04-05 23:37:08 +00:00
|
|
|
Its presence indicates that the machine's CMOS clock is set to local
|
|
|
|
time, while its absence indicates a UTC CMOS clock.
|
1998-06-04 06:35:12 +00:00
|
|
|
.El
|
1993-12-16 18:44:40 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr tzset 3 ,
|
1994-11-02 10:04:11 +00:00
|
|
|
.Xr crontab 5 ,
|
1996-04-09 11:31:34 +00:00
|
|
|
.Xr mount_msdos 8 ,
|
1997-01-13 00:25:51 +00:00
|
|
|
.Xr rc 8 ,
|
1994-11-01 16:22:22 +00:00
|
|
|
.Xr sysctl 8 ,
|
1996-04-07 00:06:21 +00:00
|
|
|
.Xr tzsetup 8 ,
|
1998-06-04 06:35:12 +00:00
|
|
|
.Xr zic 8
|
1993-12-16 18:44:40 +00:00
|
|
|
.Sh DIAGNOSTICS
|
1994-11-01 16:22:22 +00:00
|
|
|
No diagnostics.
|
1996-04-05 23:37:08 +00:00
|
|
|
If an error occurs,
|
1998-06-04 06:35:12 +00:00
|
|
|
.Nm
|
1996-04-05 23:37:08 +00:00
|
|
|
logs an error message via
|
|
|
|
.Xr syslog 3
|
|
|
|
and exits with a nonzero return code.
|
1998-03-19 07:46:04 +00:00
|
|
|
.Sh AUTHORS
|
|
|
|
.An Andrey A. Chernov Aq ache@astral.msk.su
|
1993-12-16 18:44:40 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
1998-06-04 06:35:12 +00:00
|
|
|
.Nm
|
|
|
|
command appeared in
|
|
|
|
.Fx 1.0 .
|