[2] 
[[環境変数]]
[DFN[[CODE[TZ]]]]
は、
[[Unixにおける日時]]の[[時差の記述]]を指定するものです。


* 構文

[16] 
std offset [ dst [offset],start[/time],end[/time] ]

っていう書式らしい。[[夏時間]]の指定は実装が面倒だ。

offset は、地方時に offset だけ足したら UTC ([[協定世界時]])
になるってもの。 
[[RFC 2822の日付形式]]とか多くの[[時差の記述]]の方法と[[符号][正負の符号]]が逆になるので注意。

*例

=JST-9 (cf. [[RFC2822の日付形式]]では +0900)
=EST+5
=EST+5EDT

* 文脈

[19]
いろいろな [[POSIX]] 対応[[アプリケーション]]が[[環境変数[CODE[TZ]]]]
に従い動作します。

[20] 
[[POSIX]] に対応していない[[アプリケーション]]は、 [[POSIX]]
環境であっても不完全にしか対応していなかったり、
無視したりすることがあります。

[EG[
[21] 
[[Java]] を [[POSIX]] 環境で実行しても、完全には対応していないようです。
]EG]

[22] 
[[環境変数[CODE[TZ]]]] の値の構文が他の場面で使われることもあります。

[FIG(short list)[ [5] [[POSIX時間帯]]の一部または全部を利用したもの
- [[POSIX]]
- [[tzdata]]
- [[PostgreSQL]]
- [[T2EX]] [DFN[タイムゾーン文字列]] [SRC[>>6]] 
- [CODE[Timezone:]]
]FIG]

* 歴史

[SEE[ 前史や API については[[Unixにおける日時]] ]]

-tzset(3) <http://www.linux.or.jp/JM/html/LDP_man-pages/man3/tzset.3.html>
-_tzset <http://www.microsoft.com/JAPAN/developer/library/vccore/_crt__tzset.htm>



[1] [CITE@en[POSIX and Olson time zone formats]]
( ([TIME[2016-06-15 18:40:50 +09:00]]))
<http://www.ibm.com/developerworks/aix/library/au-aix-posix/>

[3] [CITE[Time::Zone - search.cpan.org]]
([TIME[2016-10-10 11:03:27 +09:00]])
<http://search.cpan.org/dist/TimeDate/lib/Time/Zone.pm>

[4] [CITE@en[PostgreSQL: Documentation: 9.6: Date/Time Types]]
([TIME[2017-03-10 17:55:16 +09:00]])
<https://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-INTERVAL-INPUT>

[6] [[T2EX]] ([TIME[2015-03-28 15:58:08 +09:00]]) <http://www.tron.org/ja/wp-content/themes/dp-magjam/pdf/specifications/ja/TEF020-S009-02.00.00_ja.pdf#page=107>

[7] [CITE@en[Document vestigial aspects of the POSIX API]]
([[eggert]]著, [TIME[2018-01-27 03:06:13 +09:00]])
<https://github.com/eggert/tz/commit/240c8d6e29e3069d72bec323910ee6800a6155d1>

[8] [CITE@en[Clarify extensions to POSIX model]]
([[eggert]]著, [TIME[2018-02-15 07:25:37 +09:00]])
<https://github.com/eggert/tz/commit/63d30205737f4ba165f2a3cebadee90a6651438f>

[9] [CITE@en[Clarify that EST5EDT is problematic in POSIX]]
([[eggert]]著, [TIME[2018-05-22 02:05:47 +09:00]])
<https://github.com/eggert/tz/commit/f7cef15920aa7ef2094dfd742c7fd54564046c8a>

[10] [CITE['''['''tz''']''' '''['''tz-announce''']''' 2018f release of tz code and data available]]
([TIME[2018-10-24 01:27:07 +09:00]])
<https://mm.icann.org/pipermail/tz/2018-October/027058.html>

[11] [CITE['''['''tz''']''' Please remove tzdata2018f]]
([TIME[2019-02-23 05:09:31 +09:00]])
<https://mm.icann.org/pipermail/tz/2019-February/027642.html>

[12] [CITE@en[RFC 8536 - The Time Zone Information Format (TZif)]]
([TIME[2019-02-13 09:21:07 +09:00]])
<https://tools.ietf.org/html/rfc8536#section-3.3.1>

[13] [CITE['''['''tz''']''' Java & Rearguard]]
([TIME[2019-06-01 18:51:30 +09:00]])
<https://mm.icann.org/pipermail/tz/2019-June/028025.html>

[14] [CITE['''['''tz''']''' Java & Rearguard]]
([TIME[2019-06-03 17:51:05 +09:00]])
<https://mm.icann.org/pipermail/tz/2019-June/028040.html>

[15] [CITE[0001253: clarify that "alternative time" means tm_isdst is positive - Austin Group Defect Tracker]]
([TIME[2019-06-04 09:06:12 +09:00]])
<http://austingroupbugs.net/view.php?id=1253>

[17] [CITE['''['''tz''']''' Extend POSIX TZ to allow transition times outside 00-24 range, permanent DST]]
([TIME[2019-06-04 09:24:22 +09:00]])
<https://mm.icann.org/pipermail/tz/2019-June/028050.html>

[18] [CITE[0001252: Extend TZ to allow times outside 00-24 range, permanent DST - Austin Group Defect Tracker]]
([TIME[2019-06-04 09:26:29 +09:00]])
<http://austingroupbugs.net/view.php?id=1252>

[23] [CITE['''['''tz''']''' More on EU/UK/Brexit clock changes]]
([TIME[2020-02-15 15:55:08 +09:00]])
<https://mm.icann.org/pipermail/tz/2020-February/028835.html>

[24] [CITE['''['''tz''']''' Support for Etc/GMT -style zones ids with partial hours]]
([TIME[2020-10-21T21:32:04.000Z]], [TIME[2020-10-22T01:40:37.057Z]])
<https://mm.icann.org/pipermail/tz/2020-October/029396.html>