Roman's avatar

Hi, my name is Roman. I run a job board and make tutorials for BSD users. I'm fan of OpenBSD, POSIX-shell, and vi.

Twitter - RSS - Patreon - PayPal


Set time zone

Check your current time with date(1):

# date
Thu Apr  5 12:26:43 UTC 2018

As you can see the local timezone is UTC.

Your operating system uses /etc/localtime to set time zone information and that is a symbolic link to UTC time zone file. Check it with readlink(1):

# readlink /etc/localtime
/usr/share/zoneinfo/UTC

Find a file for the time zone you want to set with find(1):

# find /usr/share/zoneinfo -name 'Mos*'
/usr/share/zoneinfo/Europe/Moscow
...

The timezone name we are looking for is Europe/Moscow.

Set timezone with zic(8).

# zic -l Europe/Moscow

Check if the time zone is set correctly.

# readlink /etc/localtime
/usr/share/zoneinfo/Europe/Moscow
# date
Thu Apr  5 15:26:51 MSK 2018

Tested on OpenBSD 6.3