タイムゾーン:ルールを取得する方法

タイムゾーン:ルールを取得する方法

現在のタイムゾーンルールを確認するにはどうすればよいですか?

(、、)設定する方法はわかりましたが、tzdata別の方向に行く方法はよくわかりません。 (その中のファイルはバイナリなので読めません。たぶんコンパイルされたかもしれません。)zic/etc/timezone/usr/share/zoneinfozic

TZルールが適用されているのか、どのTZルールがあるのか​​、どうすればわかりますか(例:DSTへの移行)。

ベストアンサー1

すでにわかっているように、ソースzicゾーンファイルを.NETファイルで見られるバイナリにコンパイルします/usr/share/zoneinfo。マニュアルページの下部には、zdumpおそらく探しているツール()への参照が隠されていますzdump - time zone dumper

以下は、フランスで使用されているタイムゾーンの出力例です。2017年と2018年の2年間のDSTジャンプ日時を示しています。

zdump -V -c 2017,2019 Europe/Paris
Europe/Paris  Sun Mar 26 00:59:59 2017 UT = Sun Mar 26 01:59:59 2017 CET isdst=0 gmtoff=3600
Europe/Paris  Sun Mar 26 01:00:00 2017 UT = Sun Mar 26 03:00:00 2017 CEST isdst=1 gmtoff=7200
Europe/Paris  Sun Oct 29 00:59:59 2017 UT = Sun Oct 29 02:59:59 2017 CEST isdst=1 gmtoff=7200
Europe/Paris  Sun Oct 29 01:00:00 2017 UT = Sun Oct 29 02:00:00 2017 CET isdst=0 gmtoff=3600
Europe/Paris  Sun Mar 25 00:59:59 2018 UT = Sun Mar 25 01:59:59 2018 CET isdst=0 gmtoff=3600
Europe/Paris  Sun Mar 25 01:00:00 2018 UT = Sun Mar 25 03:00:00 2018 CEST isdst=1 gmtoff=7200
Europe/Paris  Sun Oct 28 00:59:59 2018 UT = Sun Oct 28 02:59:59 2018 CEST isdst=1 gmtoff=7200
Europe/Paris  Sun Oct 28 01:00:00 2018 UT = Sun Oct 28 02:00:00 2018 CET isdst=0 gmtoff=3600

自分のタイムゾーンのDSTジャンプを取得するのは少し面倒ですが、このコマンドは2017年のDSTジャンプを返します。ここでは、イギリスのタイムゾーンにあり、タイムゾーンラベル(夏/冬時間)がBST / GMTであることがわかります。

zdump -V -c2017,2018 $(cat /etc/timezone)
Europe/London  Sun Mar 26 00:59:59 2017 UT = Sun Mar 26 00:59:59 2017 GMT isdst=0 gmtoff=0
Europe/London  Sun Mar 26 01:00:00 2017 UT = Sun Mar 26 02:00:00 2017 BST isdst=1 gmtoff=3600
Europe/London  Sun Oct 29 00:59:59 2017 UT = Sun Oct 29 01:59:59 2017 BST isdst=1 gmtoff=3600
Europe/London  Sun Oct 29 01:00:00 2017 UT = Sun Oct 29 01:00:00 2017 GMT isdst=0 gmtoff=0

/usr/share/zoneinfoバイナリをルールファイルに再コンパイルするツールはありません。簡単に使用できる一連のソースルールから始めるのは簡単です。

おすすめ記事