OSDN Git Service

(split) Convert release and draft pages to UTF-8.
[linuxjm/LDP_man-pages.git] / draft / man3 / tzset.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified Sun Jul 25 11:01:58 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified 2001-11-13, aeb
29 .\" Modified 2004-12-01 mtk and Martin Schulze <joey@infodrom.org>
30 .\"
31 .\" Japanese Version Copyright (c) 1998 NAKANO Takeo all rights reserved.
32 .\" Translated 1998-03-23, NAKANO Takeo <nakano@apm.seikei.ac.jp>
33 .\" Updated 2000-09-14, Kentaro Shirakata <argrath@ub32.org>
34 .\" Updated 2002-01-06, NAKANO Takeo
35 .\" Updated 2007-01-07, Akihiro MOTOKI, catch up to LDP v2.43
36 .\"
37 .\" WORD:       Wall Clock Time                 壁時計時刻
38 .\" WORD:       Coordinated Universal Time      協定世界時
39 .\" WORD:       daylight saving time            サマータイム
40 .\" WORD:       Prime Meridian                  グリニッジ子午線
41 .\"
42 .TH TZSET 3  2010-02-25 "" "Linux Programmer's Manual"
43 .\"O .SH NAME
44 .\"O tzset, tzname, timezone, daylight \- initialize time conversion information
45 .SH 名前
46 tzset, tzname, timezone, daylight \- 時刻の変換情報を初期化する
47 .\"O .SH SYNOPSIS
48 .SH 書式
49 .nf
50 .B #include <time.h>
51 .sp
52 .B void tzset (void);
53 .sp
54 .BI "extern char *" tzname [2];
55 .BI "extern long " timezone ;
56 .BI "extern int " daylight ;
57 .fi
58 .sp
59 .in -4n
60 .\"O Feature Test Macro Requirements for glibc (see
61 .\"O .BR feature_test_macros (7)):
62 glibc 向けの機能検査マクロの要件
63 .RB ( feature_test_macros (7)
64 参照):
65 .in
66 .sp
67 .BR tzset ():
68 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
69 .br
70 .IR tzname :
71 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
72 .br
73 .IR timezone :
74 _SVID_SOURCE || _XOPEN_SOURCE
75 .br
76 .IR daylight :
77 _SVID_SOURCE || _XOPEN_SOURCE
78 .\"O .SH DESCRIPTION
79 .SH 説明
80 .\"O The
81 .\"O .BR tzset ()
82 .\"O function initializes the \fItzname\fP variable from the
83 .\"O .B TZ
84 .\"O environment variable.
85 .\"O This function is automatically called by the
86 .\"O other time conversion functions that depend on the timezone.
87 .\"O In a System-V-like environment, it will also set the variables \fItimezone\fP
88 .\"O (seconds West of UTC) and \fIdaylight\fP (to 0 if this timezone does not
89 .\"O have any daylight saving time rules, or to nonzero if there is a time during
90 .\"O the year when daylight saving time applies).
91 .BR tzset ()
92 関数は
93 .B TZ
94 環境変数を用いて \fItzname\fP 変数を初期化する。
95 この関数は、タイムゾーンに依存する他の時刻変換関数から自動的に呼び出される。
96 System V 的な環境では、この関数は変数 \fItimezone\fP (UTC からの西向きの秒数) と
97 \fIdaylight\fP (このタイムゾーンにサマータイムに関するルールがなければ 0、
98 サマータイム期間が一年のどこかにあれば 0 以外) も設定する。
99 .PP
100 .\"O If the
101 .\"O .B TZ
102 .\"O variable does not appear in the environment, the \fItzname\fP
103 .\"O variable is initialized with the best approximation of local wall clock
104 .\"O time, as specified by the
105 .\"O .BR tzfile (5)-format
106 .\"O file \fIlocaltime\fP
107 .\"O found in the system timezone directory (see below).
108 .B TZ
109 環境変数が設定されていない場合には、
110 \fItzname\fP 変数はローカルな壁時計時刻 (wall clock time) に
111 最も近い値に初期化される。
112 このローカルな壁時計時刻としては、
113 システムのタイムゾーンディレクトリ (後述) にある
114 .BR tzfile (5)
115 形式のファイル \fIlocaltime\fP で指定されている値が用いられる。
116 .\"O (One also often sees
117 .\"O .I /etc/localtime
118 .\"O used here, a symlink to the right file in the system timezone directory.)
119 (この際には
120 .I /etc/localtime
121 もよく用いられる。
122 これはシステムのタイムゾーンディレクトリにある
123 適切なファイルへのシンボリックリンクになっている。)
124 .PP
125 .\"O If the
126 .\"O .B TZ
127 .\"O variable does appear in the environment but its value is empty
128 .\"O or its value cannot be interpreted using any of the formats specified
129 .\"O below, Coordinated Universal Time (UTC) is used.
130 .B TZ
131 環境変数が存在しているが、その値が空だったり、
132 以下に示す形式のどれにもあてはまらない場合は、
133 協定世界時 (Coordinated Universal Time: UTC) が用いられる。
134 .PP
135 .\"O The value of
136 .\"O .B TZ
137 .\"O can be one of three formats.
138 .\"O The first format is used
139 .\"O when there is no daylight saving time in the local timezone:
140 .B TZ
141 の値は以下の 3 つの形式のいずれかを取ることができる。
142 最初の形式はサマータイム (daylight saving time)
143 を持たないローカルタイムゾーンに対して用いる。
144 .sp
145 .RS
146 .I std offset
147 .RE
148 .sp
149 .\"O The \fIstd\fP string specifies the name of the timezone and must be
150 .\"O three or more alphabetic characters.
151 .\"O The \fIoffset\fP string immediately
152 .\"O follows \fIstd\fP and specifies the time value to be added to the local
153 .\"O time to get Coordinated Universal Time (UTC).
154 .\"O The \fIoffset\fP is positive
155 .\"O if the local timezone is west of the Prime Meridian and negative if it is
156 .\"O east.
157 .\"O The hour must be between 0 and 24, and the minutes and seconds
158 .\"O 0 and 59.
159 \fIstd\fP 文字列はタイムゾーンの名前を指定する。
160 アルファベットからなる 3 文字以上の文字列でなければならない。
161 \fIoffset\fP 文字列は \fIstd\fP の直後に続き、
162 協定世界時 (UTC) を得るために
163 ローカルな時刻に加えなければならない時間を指定する。
164 .I offset
165 は、ローカルタイムゾーンがグリニッジ子午線 (Prime Meridian)
166 の西なら正の値、東なら負の値を取る。
167 時間 (hour) は 0 から 24 の間でなければならない。
168 分 (minute) と秒 (second) は 0 から 59 の間でなければならない。
169 .PP
170 .\"O The second format is used when there is daylight saving time:
171 2 番目の形式はサマータイムがある場合に用いられる。
172 .sp
173 .RS
174 .I std offset dst [offset],start[/time],end[/time]
175 .RE
176 .sp
177 .\"O There are no spaces in the specification.
178 .\"O The initial \fIstd\fP and
179 .\"O \fIoffset\fP specify the standard timezone, as described above.
180 .\"O The \fIdst\fP string and \fIoffset\fP specify the name and offset for the
181 .\"O corresponding daylight saving timezone.
182 .\"O If the offset is omitted,
183 .\"O it default to one hour ahead of standard time.
184 指定にはスペースを含めてはならない。
185 先頭の \fIstd\fP と \fIoffset\fP は 1 番目の形式と同じで、
186 標準のタイムゾーンを指定する。
187 \fIdst\fP 文字列と \fIoffset\fP は、
188 対応するサマータイムゾーンの名前とオフセットを指定する。
189 オフセットが省略されると、デフォルトでは標準の一時間前となる。
190 .PP
191 .\"O The \fIstart\fP field specifies when daylight saving time goes into
192 .\"O effect and the \fIend\fP field specifies when the change is made back to
193 .\"O standard time.
194 .\"O These fields may have the following formats:
195 \fIstart\fP フィールドはサマータイムが有効になる時刻、
196 \fIend\fP フィールドは標準に戻る時刻である。
197 これらのフィールドは以下の形式で指定する。
198 .TP
199 J\fIn\fP
200 .\"O This specifies the Julian day with \fIn\fP between 1 and 365.
201 .\"O February 29 is never counted even in leap years.
202 年の通日 (Julian day) で日にちを指定する。
203 \fIn\fP は 1 から 365 の間の数値。
204 うるう年の場合でも 2 月 29 日はカウントされない。
205 .TP
206 .I n
207 .\"O This specifies the Julian day with \fIn\fP between 1 and 365.
208 .\"O February 29 is counted in leap years.
209 年の通日で日にちを指定する。
210 \fIn\fP は 1 から 365 の間の数値。
211 うるう年の場合には 2 月 29 日がカウントされる。
212 .TP
213 M\fIm\fP.\fIw\fP.\fId\fP
214 .\"O This specifies day \fId\fP (0 <= \fId\fP <= 6) of week \fIw\fP
215 .\"O (1 <= \fIw\fP <= 5) of month \fIm\fP (1 <= \fIm\fP <= 12).
216 .\"O Week 1 is
217 .\"O the first week in which day \fId\fP occurs and week 5 is the last week
218 .\"O in which day \fId\fP occurs.
219 .\"O Day 0 is a Sunday.
220 \fIm\fP は月 (1 <= \fIm\fP <= 12) を、
221 \fIw\fP は月のうちの週 (1 <= \fIw\fP <= 5) を、
222 \fId\fP は週のうちの日にち (0 <= \fId\fP <= 6) を示す。
223 \fIw\fP = 1 は所属する \fId\fP が存在する最初の週、
224 \fIw\fP = 5 は最後の週である。
225 \fId\fP = 0 は日曜日である。
226 .PP
227 .\"O The \fItime\fP fields specify when, in the local time currently in effect,
228 .\"O the change to the other time occurs.
229 .\"O If omitted, the default is 02:00:00.
230 \fItime\fP フィールドは、ローカルタイムを切り替える時刻を、
231 変更前のローカルタイムで表したものである。
232 省略された場合のデフォルトは 02:00:00 である。
233
234 .\"O Here is an example for New Zealand,
235 .\"O where the standard time (NZST) is 12 hours ahead of UTC,
236 .\"O and daylight saving time (NZDT), 13 hours ahead of UTC,
237 .\"O runs from the first Sunday in October to the third Sunday in March,
238 .\"O and the changeovers happen at the default time of 02:00:00:
239 ニュージーランドの例である。
240 ニュージーランドでは、標準のタイムゾーン (NZST) は UTC より 12時間進んでおり、
241 サマータイム (NZDT) は UTC の 13時間進んでいる。
242 サマータイムは 10月の第一日曜から 3月の第三日曜までであり、
243 ローカルタイムの切り替えはデフォルトの 02:00:00 に行われる。
244 .nf
245
246     TZ="NZST-12:00:00NZDT-13:00:00,M10.1.0,M3.3.0"
247 .fi
248 .PP
249 .\"O The third format specifies that the timezone information should be read
250 .\"O from a file:
251 3 番目の形式は、タイムゾーンの情報をファイルから読み込むように指定する。
252 .sp
253 .RS
254 :[filespec]
255 .RE
256 .sp
257 .\"O If the file specification \fIfilespec\fP is omitted, the timezone
258 .\"O information is read from the file
259 .\"O .I localtime
260 .\"O in the system timezone directory, which nowadays usually is
261 .\"O .IR /usr/share/zoneinfo .
262 ファイルの指定 \fIfilespec\fP が省略された場合は、
263 タイムゾーンの情報はシステムタイムゾーンディレクトリの
264 .I localtime
265 ファイルから読まれる。
266 最近ではシステムタイムゾーンディレクトリは普通
267 .I /usr/share/zoneinfo/localtime
268 である。
269 .\"O This file is in
270 .\"O .BR tzfile (5)
271 .\"O format.
272 .\"O If \fIfilespec\fP is given, it specifies another
273 .\"O .BR tzfile (5)-format
274 .\"O file to read the timezone information from.
275 .\"O If \fIfilespec\fP does not begin with a \(aq/\(aq, the file specification is
276 .\"O relative to the system timezone directory.
277 このファイルは
278 .BR tzfile (5)
279 形式で書かれている。
280 \fIfilespec\fP が与えられた場合は、
281 タイムゾーンの情報をそのファイルから読み込む。このファイルも
282 .BR tzfile (5)
283 形式で書かれている必要がある。
284 \fIfilespec\fP が \(aq/\(aq で始まらなかった場合には、
285 システムタイムゾーンディレクトリからの相対パスで
286 ファイルが指定されたことになる。
287 .PP
288 .\"O Here's an example, once more for New Zealand:
289 例を挙げておく。もう一度ニュージーランドの例である。
290 .nf
291
292     TZ=":Pacific/Auckland"
293 .fi
294 .\"O .SH FILES
295 .SH ファイル
296 .\"O The system timezone directory used depends on the (g)libc version.
297 用いられるシステムタイムゾーンディレクトリは (g)libc のバージョンに依存する。
298 .\"O Libc4 and libc5 use
299 .\"O .IR /usr/lib/zoneinfo ,
300 .\"O and, since libc-5.4.6,
301 .\"O when this doesn't work, will try
302 .\"O .IR /usr/share/zoneinfo .
303 libc4 と libc5 は
304 .I /usr/lib/zoneinfo
305 を用いる。libc-5.4.6 以降では、これが使えなかった場合には
306 .I /usr/share/zoneinfo
307 を使おうとする。
308 .\"O Glibc2 will use the environment variable
309 .\"O .BR TZDIR ,
310 .\"O when that exists.
311 glibc2 では環境変数
312 .B TZDIR
313 が存在すればそれを用いる。
314 .\"O Its default depends on how it was installed, but normally is
315 .\"O .IR /usr/share/zoneinfo .
316 このデフォルトはどのようにインストールされたかによるが、
317 普通は
318 .I /usr/share/zoneinfo
319 である。
320 .LP
321 .\"O This timezone directory contains the files
322 このタイムゾーンディレクトリには以下のファイルが含まれる。
323 .sp
324 .nf
325 .\"O localtime      local timezone file
326 .\"O posixrules     rules for POSIX-style TZ's
327 localtime      ローカルタイムゾーンのファイル
328 posixrules     POSIX 式の TZ 書式ルール
329 .fi
330 .LP
331 .\"O Often
332 .\"O .I /etc/localtime
333 .\"O is a symlink to the file
334 .\"O .I localtime
335 .\"O or to the correct timezone file in the system timezone directory.
336 .I /etc/localtime
337 は、
338 .I localtime
339 ファイルや、
340 システムのタイムゾーンディレクトリ中の適切なタイムゾーンファイルへの
341 シンボリックリンクであることが多い。
342 .\"O .SH "CONFORMING TO"
343 .SH 準拠
344 SVr4, POSIX.1-2001, 4.3BSD.
345 .\"O .SH NOTES
346 .SH 注意
347 .\"O Note that the variable \fIdaylight\fP does not indicate that daylight
348 .\"O saving time applies right now.
349 .\"O It used to give the number of some
350 .\"O algorithm (see the variable \fItz_dsttime\fP in
351 .\"O .BR gettimeofday (2)).
352 .\"O It has been obsolete for many years but is required by SUSv2.
353 .I daylight
354 変数は、現在がサマータイムであるかどうかを示しているのではない。
355 これはいくつかあるアルゴリズムのうちの番号を与える
356 (アルゴリズムについては
357 .BR gettimeofday (2)
358
359 .I tz_dsttime
360 変数を見よ)。
361 これはもう何年も使われていないが、SUSv2 では必要とされている。
362 .LP
363 .\"O 4.3BSD had a function
364 .\"O .BI "char *timezone(" zone ", " dst )
365 .\"O that returned the
366 .\"O name of the timezone corresponding to its first argument (minutes
367 .\"O West of UTC).
368 .\"O If the second argument was 0, the standard name was used,
369 .\"O otherwise the daylight saving time version.
370 4.3BSD には
371 .BI "char *timezone(" zone ", " dst )
372 というルーチンがあり、これは
373 最初の引数 (UTC からの西向きの分数) に対応するタイムゾーンの名前を返す。
374 二番目の引数が 0 の場合は標準の名前が用いられ、
375 それ以外はサマータイム版の名前が用いられる。
376 .\"O .SH "SEE ALSO"
377 .SH 関連項目
378 .BR date (1),
379 .BR gettimeofday (2),
380 .BR time (2),
381 .BR ctime (3),
382 .BR getenv (3),
383 .BR tzfile (5)