DEV Community

loading...
Cover image for Managing Timezone In OpenBSD

Managing Timezone In OpenBSD

nabbisen profile image Heddi Nabbisen Updated on ・1 min read

* 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
Enter fullscreen mode Exit fullscreen mode

We have UTC.

According to OpenBSD - 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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

In my case in Japan:

# ln -fs /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
Enter fullscreen mode Exit fullscreen mode

The result is:

$ date
Mon Dec  3 22:56:30 JST 2018
Enter fullscreen mode Exit fullscreen mode

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 🕊

Discussion (0)

pic
Editor guide