* The cover image is originally by Tentes and edited with great appreciation.
Summary
This post is about how to check and configure the timezone in OpenBSD.
Environment
- OS: OpenBSD 6.4 amd64
Tutorial
Step 1: Check the timezone
Let's check the current timezone with date
command:
$ date
Mon Dec 3 13:43:30 UTC 2018
We have UTC.
According to their documentation on TZSET(3),
-
/etc/localtime
is "local time zone file". -
/usr/share/zoneinfo
is "time zone information directory".
Then, let's investigate why it is by checking /etc/localtime
:
$ ls -l /etc/localtime
lrwxr-xr-x 1 root wheel 23 Jun 12 21:27 /etc/localtime -> /usr/share/zoneinfo/UTC
Now we know it is because /etc/localtime
is linked to UTC
in /usr/share/zoneinfo/
.
Step 2: Configure the timezone
How can we configure the timezone?
Let's change the link with ln
command:
# ln -fs /usr/share/zoneinfo/%your-location% /etc/localtime
In my case in Japan:
# ln -fs /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
The result is:
$ date
Mon Dec 3 22:56:30 JST 2018
Yep 😃
Reference
OpenBSD FAQ - General Questions - Time Zone
They say:
If you have need to change the time zone, you can create a new symbolic link to the appropriate time zone file in /usr/share/zoneinfo.
Happy serving 🕊