xref: /freebsd/usr.sbin/tzsetup/tzsetup.8 (revision edf8578117e8844e02c0121147f45e4609b30680)
1.\" Copyright (c) 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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.Dd April 18, 2023
26.Dt TZSETUP 8
27.Os
28.Sh NAME
29.Nm tzsetup
30.Nd set local timezone
31.Sh SYNOPSIS
32.Nm
33.Op Fl nrs
34.Op Fl C Ar chroot_directory
35.Op Ar zoneinfo_file | zoneinfo_name
36.Sh DESCRIPTION
37The
38.Nm
39utility reads a database of timezone information and presents a menu
40allowing the user to select a specific zone without knowing the details
41of the database layout.
42The selected zone is installed as the system
43default zone.
44The
45.Nm
46utility also determines whether any adjustment is necessary for systems where
47the hardware clock does not keep UTC.
48.Pp
49The following options are available:
50.Bl -tag -offset indent -width Fl
51.It Fl C Ar chroot_directory
52Open all files and directories relative to
53.Ar chroot_directory .
54.It Fl n
55Do not create or copy files.
56.It Fl r
57Reinstall the zoneinfo file installed last time.
58The name is obtained from
59.Pa /var/db/zoneinfo .
60.It Fl s
61Skip the initial question about adjusting the clock if not set to UTC.
62.El
63.Pp
64It is possible to short-circuit the menu system by specifying the
65location of a
66.Ar zoneinfo_file
67or the name of the
68.Ar zoneinfo_name
69on the command line; this is intended mainly for pre-configured installation
70scripts or people who know which zoneinfo they want to install.
71.Sh TIMEZONE DATABASE
72The contents of the timezone database are indexed by
73.Pa /usr/share/zoneinfo/zone1970.tab .
74This file lists, for each timezone data file, the ISO 3166 territory code,
75approximate geographical coordinates (in ISO 6709 format),
76and location within the territory.
77.Pp
78The maintainers of the database maintain the following policies:
79.Bl -enum -offset indent
80.It
81At least one zone for every country or inhabited geographical territory.
82.It
83One zone for every distinct, documented timezone history since the
84beginning of the
85.Ux
86epoch (January 1, 1970, GMT).
87.It
88Each zone is named for the most populous city therein.
89(Where possible,
90the database includes pre-1970 history for its city.)
91.El
92.Pp
93The source code to the database
94.Pq Pa /usr/src/contrib/tzdata/[a-z]*
95contains many additional comments and documentation references for the
96historically minded.
97.Sh FILES
98.Bl -tag -width ".Pa /usr/share/zoneinfo/zone1970.tab" -compact
99.It Pa /etc/localtime
100current time zone file
101.It Pa /etc/wall_cmos_clock
102see
103.Xr adjkerntz 8
104.It Pa /usr/share/misc/iso3166
105mapping of ISO 3166 territory codes to names
106.It Pa /usr/share/zoneinfo
107directory for zoneinfo files
108.It Pa /usr/share/zoneinfo/zone1970.tab
109mapping of timezone file to country and location
110.It Pa /var/db/zoneinfo
111saved name of the timezone file installed last
112.El
113.Sh EXAMPLES
114Normal usage, to select the right zoneinfo file via the dialog-based
115user interface:
116.Pp
117.Dl # tzsetup
118.Pp
119Install the file
120.Pa /usr/share/zoneinfo/Australia/Sydney :
121.Pp
122.Dl "# tzsetup /usr/share/zoneinfo/Australia/Sydney"
123.Pp
124Install the zoneinfo file for Australia/Sydney, assumed to be located in
125.Pa /usr/share/zoneinfo :
126.Pp
127.Dl "# tzsetup Australia/Sydney"
128.Pp
129After a reinstall of the zoneinfo files, you can reinstall the
130latest installed zoneinfo file (as specified in
131.Pa /var/db/zoneinfo ) :
132.Pp
133.Dl "# tzsetup -r"
134.Sh SEE ALSO
135.Xr date 1 ,
136.Xr adjtime 2 ,
137.Xr ctime 3 ,
138.Xr timezone 3 ,
139.Xr tzfile 5 ,
140.Xr adjkerntz 8 ,
141.Xr zdump 8 ,
142.Xr zic 8
143.Sh DISCLAIMER
144The representation of certain localities as being associated with certain
145countries and/or territories is for the purposes of identification only,
146and does not imply any endorsement or rejection on the part of the
147.Fx
148Project of the territorial claims of any entity.
149.Sh BUGS
150Programs which are already running when
151.Nm
152creates or updates
153.Pa /etc/localtime
154will not reflect the updated timezone.
155When the system is first configured for a non-UTC
156hardware clock, it is necessary to run
157.Xr adjkerntz 8
158(which normally happens as a part of system startup) in order to update
159the kernel's idea of the correct timezone offset.
160