# how to set time?



## hirohitosan (Jan 21, 2009)

Sorry for this question, but how to set hour in FreBSD. I set the time zone at installation but after starting X I realize that my clock is not set.

there is a tool for setting time?

tahnks


----------



## kamikaze (Jan 21, 2009)

You can set the time with the date(1) command.

You can also run ntpd to automatically sync your time with a time server.


----------



## sniper007 (Jan 21, 2009)

Or better way, use NTP

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-ntp.html


----------



## hirohitosan (Jan 21, 2009)

Thanks guys
I add in /etc/rc.conf

```
ntpdate_enable="YES"
```
and create the file /etc/ntp.conf
and add

```
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server pool.ntp.org
driftfile /var/db/ntp.drift
```


----------



## DutchDaemon (Jan 21, 2009)

I'd advise using openntpd (from ports), which will not open a listener on port 123 (which only ntp servers need) unless you tell it to.


----------



## SirDice (Jan 21, 2009)

I also advise, if possible, to use the ISP's ntp server.


----------



## DutchDaemon (Jan 21, 2009)

Sure. I lack enthusiasm for the pool.ntp.org servers. I've seen weird (big) time shifts (and associated alerts from panicking applications) when using those. They're not exactly 'professional' time servers, and they vary wildly in stratum quality.


----------



## sniper007 (Jan 21, 2009)

I had problems with openntpd and Freebsd 7.1. With Freebsd 6.4 works fine.


----------



## DutchDaemon (Jan 21, 2009)

Running openntpd on 7.1-STABLE (Jan 6 & Jan 8 builds) without a hitch. Haven't recompiled recently; the binary is dated March 4.


----------



## SirDice (Jan 21, 2009)

hirohitosan said:
			
		

> Thanks guys
> I add in /etc/rc.conf
> 
> ```
> ...


Do note that ntpdate will only set/correct the time when the system is booted.
If you want to keep the time correct continuously try ntpd (base) or openntpd (port).


----------



## hirohitosan (Jan 22, 2009)

Thanks again.
I installed openntpd (from ports), and add in rc.conf
ntpd_enable="YES"
and crate /etc/ntpd.conf, add time server, reboot (I couldn't find a more elegant way) and seems to work well.


----------



## DutchDaemon (Jan 22, 2009)

You'll need *openntpd_enable="YES"* .. and openntpd's config is in */usr/local/etc/ntpd.conf* !


----------



## nilsson (Jan 22, 2009)

I've been running ntpdate in cron and it seems to do the job. Am I missing something?


----------



## sniper007 (Jan 22, 2009)

Why you don't read handbook ? It's FREE :e



> Basic Configuration
> 
> If you only wish to synchronize your clock when the machine boots up, you can use ntpdate(8). This may be appropriate for some desktop machines which are frequently rebooted and only require infrequent synchronization, but most machines should run ntpd(8).
> 
> ...


----------

