.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" References consulted: .\" Linux libc source code .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) .\" 386BSD man pages .\" Modified Sun Jul 25 11:01:58 1993 by Rik Faith (faith@cs.unc.edu) .\" Modified 2001-11-13, aeb .\" Modified 2004-12-01 mtk and Martin Schulze .\" .\" Japanese Version Copyright (c) 1998 NAKANO Takeo all rights reserved. .\" Translated 1998-03-23, NAKANO Takeo .\" Updated 2000-09-14, Kentaro Shirakata .\" Updated 2002-01-06, NAKANO Takeo .\" Updated 2007-01-07, Akihiro MOTOKI, catch up to LDP v2.43 .\" .\" WORD: Wall Clock Time 壁時計時刻 .\" WORD: Coordinated Universal Time 協定世界時 .\" WORD: daylight saving time サマータイム .\" WORD: Prime Meridian グリニッジ子午線 .\" .TH TZSET 3 2010-02-25 "" "Linux Programmer's Manual" .\"O .SH NAME .\"O tzset, tzname, timezone, daylight \- initialize time conversion information .SH 名前 tzset, tzname, timezone, daylight \- 時刻の変換情報を初期化する .\"O .SH SYNOPSIS .SH 書式 .nf .B #include .sp .B void tzset (void); .sp .BI "extern char *" tzname [2]; .BI "extern long " timezone ; .BI "extern int " daylight ; .fi .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .BR tzset (): _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE .br .IR tzname : _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE .br .IR timezone : _SVID_SOURCE || _XOPEN_SOURCE .br .IR daylight : _SVID_SOURCE || _XOPEN_SOURCE .\"O .SH DESCRIPTION .SH 説明 .\"O The .\"O .BR tzset () .\"O function initializes the \fItzname\fP variable from the .\"O .B TZ .\"O environment variable. .\"O This function is automatically called by the .\"O other time conversion functions that depend on the timezone. .\"O In a System-V-like environment, it will also set the variables \fItimezone\fP .\"O (seconds West of UTC) and \fIdaylight\fP (to 0 if this timezone does not .\"O have any daylight saving time rules, or to nonzero if there is a time during .\"O the year when daylight saving time applies). .BR tzset () 関数は .B TZ 環境変数を用いて \fItzname\fP 変数を初期化する。 この関数は、タイムゾーンに依存する他の時刻変換関数から自動的に呼び出される。 System V 的な環境では、この関数は変数 \fItimezone\fP (UTC からの西向きの秒数) と \fIdaylight\fP (このタイムゾーンにサマータイムに関するルールがなければ 0、 サマータイム期間が一年のどこかにあれば 0 以外) も設定する。 .PP .\"O If the .\"O .B TZ .\"O variable does not appear in the environment, the \fItzname\fP .\"O variable is initialized with the best approximation of local wall clock .\"O time, as specified by the .\"O .BR tzfile (5)-format .\"O file \fIlocaltime\fP .\"O found in the system timezone directory (see below). .B TZ 環境変数が設定されていない場合には、 \fItzname\fP 変数はローカルな壁時計時刻 (wall clock time) に 最も近い値に初期化される。 このローカルな壁時計時刻としては、 システムのタイムゾーンディレクトリ (後述) にある .BR tzfile (5) 形式のファイル \fIlocaltime\fP で指定されている値が用いられる。 .\"O (One also often sees .\"O .I /etc/localtime .\"O used here, a symlink to the right file in the system timezone directory.) (この際には .I /etc/localtime もよく用いられる。 これはシステムのタイムゾーンディレクトリにある 適切なファイルへのシンボリックリンクになっている。) .PP .\"O If the .\"O .B TZ .\"O variable does appear in the environment but its value is empty .\"O or its value cannot be interpreted using any of the formats specified .\"O below, Coordinated Universal Time (UTC) is used. .B TZ 環境変数が存在しているが、その値が空だったり、 以下に示す形式のどれにもあてはまらない場合は、 協定世界時 (Coordinated Universal Time: UTC) が用いられる。 .PP .\"O The value of .\"O .B TZ .\"O can be one of three formats. .\"O The first format is used .\"O when there is no daylight saving time in the local timezone: .B TZ の値は以下の 3 つの形式のいずれかを取ることができる。 最初の形式はサマータイム (daylight saving time) を持たないローカルタイムゾーンに対して用いる。 .sp .RS .I std offset .RE .sp .\"O The \fIstd\fP string specifies the name of the timezone and must be .\"O three or more alphabetic characters. .\"O The \fIoffset\fP string immediately .\"O follows \fIstd\fP and specifies the time value to be added to the local .\"O time to get Coordinated Universal Time (UTC). .\"O The \fIoffset\fP is positive .\"O if the local timezone is west of the Prime Meridian and negative if it is .\"O east. .\"O The hour must be between 0 and 24, and the minutes and seconds .\"O 0 and 59. \fIstd\fP 文字列はタイムゾーンの名前を指定する。 アルファベットからなる 3 文字以上の文字列でなければならない。 \fIoffset\fP 文字列は \fIstd\fP の直後に続き、 協定世界時 (UTC) を得るために ローカルな時刻に加えなければならない時間を指定する。 .I offset は、ローカルタイムゾーンがグリニッジ子午線 (Prime Meridian) の西なら正の値、東なら負の値を取る。 時間 (hour) は 0 から 24 の間でなければならない。 分 (minute) と秒 (second) は 0 から 59 の間でなければならない。 .PP .\"O The second format is used when there is daylight saving time: 2 番目の形式はサマータイムがある場合に用いられる。 .sp .RS .I std offset dst [offset],start[/time],end[/time] .RE .sp .\"O There are no spaces in the specification. .\"O The initial \fIstd\fP and .\"O \fIoffset\fP specify the standard timezone, as described above. .\"O The \fIdst\fP string and \fIoffset\fP specify the name and offset for the .\"O corresponding daylight saving timezone. .\"O If the offset is omitted, .\"O it default to one hour ahead of standard time. 指定にはスペースを含めてはならない。 先頭の \fIstd\fP と \fIoffset\fP は 1 番目の形式と同じで、 標準のタイムゾーンを指定する。 \fIdst\fP 文字列と \fIoffset\fP は、 対応するサマータイムゾーンの名前とオフセットを指定する。 オフセットが省略されると、デフォルトでは標準の一時間前となる。 .PP .\"O The \fIstart\fP field specifies when daylight saving time goes into .\"O effect and the \fIend\fP field specifies when the change is made back to .\"O standard time. .\"O These fields may have the following formats: \fIstart\fP フィールドはサマータイムが有効になる時刻、 \fIend\fP フィールドは標準に戻る時刻である。 これらのフィールドは以下の形式で指定する。 .TP J\fIn\fP .\"O This specifies the Julian day with \fIn\fP between 1 and 365. .\"O February 29 is never counted even in leap years. 年の通日 (Julian day) で日にちを指定する。 \fIn\fP は 1 から 365 の間の数値。 うるう年の場合でも 2 月 29 日はカウントされない。 .TP .I n .\"O This specifies the Julian day with \fIn\fP between 1 and 365. .\"O February 29 is counted in leap years. 年の通日で日にちを指定する。 \fIn\fP は 1 から 365 の間の数値。 うるう年の場合には 2 月 29 日がカウントされる。 .TP M\fIm\fP.\fIw\fP.\fId\fP .\"O This specifies day \fId\fP (0 <= \fId\fP <= 6) of week \fIw\fP .\"O (1 <= \fIw\fP <= 5) of month \fIm\fP (1 <= \fIm\fP <= 12). .\"O Week 1 is .\"O the first week in which day \fId\fP occurs and week 5 is the last week .\"O in which day \fId\fP occurs. .\"O Day 0 is a Sunday. \fIm\fP は月 (1 <= \fIm\fP <= 12) を、 \fIw\fP は月のうちの週 (1 <= \fIw\fP <= 5) を、 \fId\fP は週のうちの日にち (0 <= \fId\fP <= 6) を示す。 \fIw\fP = 1 は所属する \fId\fP が存在する最初の週、 \fIw\fP = 5 は最後の週である。 \fId\fP = 0 は日曜日である。 .PP .\"O The \fItime\fP fields specify when, in the local time currently in effect, .\"O the change to the other time occurs. .\"O If omitted, the default is 02:00:00. \fItime\fP フィールドは、ローカルタイムを切り替える時刻を、 変更前のローカルタイムで表したものである。 省略された場合のデフォルトは 02:00:00 である。 .\"O Here is an example for New Zealand, .\"O where the standard time (NZST) is 12 hours ahead of UTC, .\"O and daylight saving time (NZDT), 13 hours ahead of UTC, .\"O runs from the first Sunday in October to the third Sunday in March, .\"O and the changeovers happen at the default time of 02:00:00: ニュージーランドの例である。 ニュージーランドでは、標準のタイムゾーン (NZST) は UTC より 12時間進んでおり、 サマータイム (NZDT) は UTC の 13時間進んでいる。 サマータイムは 10月の第一日曜から 3月の第三日曜までであり、 ローカルタイムの切り替えはデフォルトの 02:00:00 に行われる。 .nf TZ="NZST-12.00:00NZDT-13:00:00,M10.1.0,M3.3.0" .fi .PP .\"O The third format specifies that the timezone information should be read .\"O from a file: 3 番目の形式は、タイムゾーンの情報をファイルから読み込むように指定する。 .sp .RS :[filespec] .RE .sp .\"O If the file specification \fIfilespec\fP is omitted, the timezone .\"O information is read from the file .\"O .I localtime .\"O in the system timezone directory, which nowadays usually is .\"O .IR /usr/share/zoneinfo . ファイルの指定 \fIfilespec\fP が省略された場合は、 タイムゾーンの情報はシステムタイムゾーンディレクトリの .I localtime ファイルから読まれる。 最近ではシステムタイムゾーンディレクトリは普通 .I /usr/share/zoneinfo/localtime である。 .\"O This file is in .\"O .BR tzfile (5) .\"O format. .\"O If \fIfilespec\fP is given, it specifies another .\"O .BR tzfile (5)-format .\"O file to read the timezone information from. .\"O If \fIfilespec\fP does not begin with a \(aq/\(aq, the file specification is .\"O relative to the system timezone directory. このファイルは .BR tzfile (5) 形式で書かれている。 \fIfilespec\fP が与えられた場合は、 タイムゾーンの情報をそのファイルから読み込む。このファイルも .BR tzfile (5) 形式で書かれている必要がある。 \fIfilespec\fP が \(aq/\(aq で始まらなかった場合には、 システムタイムゾーンディレクトリからの相対パスで ファイルが指定されたことになる。 .PP .\"O Here's an example, once more for New Zealand: 例を挙げておく。もう一度ニュージーランドの例である。 .nf TZ=":Pacific/Auckland" .fi .\"O .SH FILES .SH ファイル .\"O The system timezone directory used depends on the (g)libc version. 用いられるシステムタイムゾーンディレクトリは (g)libc のバージョンに依存する。 .\"O Libc4 and libc5 use .\"O .IR /usr/lib/zoneinfo , .\"O and, since libc-5.4.6, .\"O when this doesn't work, will try .\"O .IR /usr/share/zoneinfo . libc4 と libc5 は .I /usr/lib/zoneinfo を用いる。libc-5.4.6 以降では、これが使えなかった場合には .I /usr/share/zoneinfo を使おうとする。 .\"O Glibc2 will use the environment variable .\"O .BR TZDIR , .\"O when that exists. glibc2 では環境変数 .B TZDIR が存在すればそれを用いる。 .\"O Its default depends on how it was installed, but normally is .\"O .IR /usr/share/zoneinfo . このデフォルトはどのようにインストールされたかによるが、 普通は .I /usr/share/zoneinfo である。 .LP .\"O This timezone directory contains the files このタイムゾーンディレクトリには以下のファイルが含まれる。 .sp .nf .\"O localtime local timezone file .\"O posixrules rules for POSIX-style TZ's localtime ローカルタイムゾーンのファイル posixrules POSIX 式の TZ 書式ルール .fi .LP .\"O Often .\"O .I /etc/localtime .\"O is a symlink to the file .\"O .I localtime .\"O or to the correct timezone file in the system timezone directory. .I /etc/localtime は、 .I localtime ファイルや、 システムのタイムゾーンディレクトリ中の適切なタイムゾーンファイルへの シンボリックリンクであることが多い。 .\"O .SH "CONFORMING TO" .SH 準拠 SVr4, POSIX.1-2001, 4.3BSD. .\"O .SH NOTES .SH 注意 .\"O Note that the variable \fIdaylight\fP does not indicate that daylight .\"O saving time applies right now. .\"O It used to give the number of some .\"O algorithm (see the variable \fItz_dsttime\fP in .\"O .BR gettimeofday (2)). .\"O It has been obsolete for many years but is required by SUSv2. .I daylight 変数は、現在がサマータイムであるかどうかを示しているのではない。 これはいくつかあるアルゴリズムのうちの番号を与える (アルゴリズムについては .BR gettimeofday (2) の .I tz_dsttime 変数を見よ)。 これはもう何年も使われていないが、SUSv2 では必要とされている。 .LP .\"O 4.3BSD had a function .\"O .BI "char *timezone(" zone ", " dst ) .\"O that returned the .\"O name of the timezone corresponding to its first argument (minutes .\"O West of UTC). .\"O If the second argument was 0, the standard name was used, .\"O otherwise the daylight saving time version. 4.3BSD には .BI "char *timezone(" zone ", " dst ) というルーチンがあり、これは 最初の引数 (UTC からの西向きの分数) に対応するタイムゾーンの名前を返す。 二番目の引数が 0 の場合は標準の名前が用いられ、 それ以外はサマータイム版の名前が用いられる。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR date (1), .BR gettimeofday (2), .BR time (2), .BR ctime (3), .BR getenv (3), .BR tzfile (5)