Move clock forward by one hour?

Simple problem, daylight savings has kicked in in NZ, and I need the clock forward by an hour. I know I can set a new time but I'm pedantic and don't want to lose the seconds.

Code:
date -v +1H

Does what I want, but doesn't "set" the time. Why not? And how can I set it?

Cheers.
 
The FreeBSD kernel clock is always set at UTC, according the adjkerntz man page.

The hour is so still the same ; it's your local timezone that has changed from NZST to NZDT.

So you should consider instead to set your date as UTC and keeps it updated at regular interval with ntpdate, running the following command as root:
# ntpdate nz.pool.ntp.org

Then, you have two options:

(1) put all the system in local timezone:
# cp /usr/share/zoneinfo/Pacific/Auckland /etc/localtime

(2) use the environment variable TZ to display the timezone in your account:
$ setenv TZ Pacific/Auckland
or if you use bash:
$ export TZ=Pacific/Auckland

In both cases, your system will be UTC compliant and will handle automatically summer time.

Finally, you can also configure your system to synchronize automatically the time, adding the following lines in /etc/rc.conf:
Code:
ntpdate_enable="YES"
ntpdate_hosts="nz.pool.ntp.org"
 
Dereckson said:
Finally, you can also configure your system to synchronize automatically the time, adding the following lines in /etc/rc.conf:
Code:
ntpdate_enable="YES"
ntpdate_hosts="nz.pool.ntp.org"

That won't keep your clock in sync as it will only run once at boottime.

Instead of using the (now deprecated) ntpdate cmd, enable ntpd instead
Code:
ntpd_enable="YES"
ntpd_sync_on_start="YES"

You should also add one or more timeservers to /etc/ntp.conf
 
Dereckson said:
(1) put all the system in local timezone:
# cp /usr/share/zoneinfo/Pacific/Auckland /etc/localtime
I prefer to make symbolink link
# ln -s /usr/share/zoneinfo/Europe/Riga /etc/localtime
 
Back
Top