# Move clock forward by one hour?



## caesius (Sep 27, 2010)

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.


```
date -v +1H
```

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

Cheers.


----------



## graudeejs (Sep 27, 2010)

`# date -f %s `date -v +1H +%s``


----------



## Dereckson (Sep 27, 2010)

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:

```
ntpdate_enable="YES"
ntpdate_hosts="nz.pool.ntp.org"
```


----------



## jalla (Sep 27, 2010)

Dereckson said:
			
		

> Finally, you can also configure your system to synchronize automatically the time, adding the following lines in /etc/rc.conf:
> 
> ```
> ntpdate_enable="YES"
> ...



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

```
ntpd_enable="YES"
ntpd_sync_on_start="YES"
```

You should also add one or more timeservers to /etc/ntp.conf


----------



## graudeejs (Sep 27, 2010)

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`


----------

