9
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Max OSX Yosemite と Linux でシステムの timezone を変更する方法

Posted at

Timezone変更の方法

システムのtimezoneを変更した際のメモです。
以下はMaxOSX Yosemiteで行った際のメモになります。

Mac Yosemiteでは

System Preferences > Date & Time > Timezoneから指定ができます。
これで画面上部の時刻表示の部分が管理されている様です。

Screen Shot 2015-03-24 at 11.23.02.png

あとで分かりましたが、これから紹介するtimezone変更方法を使って変更しても、ここで指定したTimezoneのまま表示されました。

システム的には

timezoneからlocaltimeを指定しているファイルは以下ににあります。

/etc/localtime

ここに書き込んである内容がlocaltimeとして使われるようです。

各timezoneのファイルは以下にあります。

$ ls /usr/share/zoneinfo
---
./           Asia/        Canada/      Egypt        GB-Eire      HST          Jamaica      MST7MDT      PST8PDT      Singapore    W-SU
../          Atlantic/    Chile/       Eire         GMT          Hongkong     Japan        Mexico/      Pacific/     Turkey       WET
Africa/      Australia/   Cuba         Etc/         GMT+0        Iceland      Kwajalein    NZ           Poland       UCT          Zulu
America/     Brazil/      EET          Europe/      GMT-0        Indian/      Libya        NZ-CHAT      Portugal     US/          iso3166.tab
Antarctica/  CET          EST          Factory      GMT0         Iran         MET          Navajo       ROC          UTC          posixrules
Arctic/      CST6CDT      EST5EDT      GB           Greenwich    Israel       MST          PRC          ROK          Universal    zone.tab

なので、↑から/etc/localtimeへ中身をコピーするなり、シンボリックリンクを貼るなりするといいかと思います。

$ sudo rm /etc/localtime; sudo ln -s /usr/share/zoneinfo/Japan /etc/localtime

ちなみにJSTはJapan、UTCはUTCにの中に記述があります。

timezoneを変更してみると

先述の通り、Macの時刻表示の部分は変化しませんでした。(正確には一度変更が反映されたけど、数秒後元に戻りました)

Mac上のアプリでは反映されていました。
PM 5:41の後TimezoneをJST->UTCに変更し、PM 6:35ころ、UTC->JSTに変更した際の、LINEの画面です。
ネコ型てっちん.png

9
7
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?