# serve ntpd only from hwclock?

## dasPaul

Hi

I have a Raspberry Pi with a RTC Module. Ntpd is running on it and serves the time 

among my local clients. I do not fully understand how and what time is served

from ntpd. 

Is this correct that ntpd connects from time to time to an external server

to correct the drift and sets the swclock (and not hwclock)? If yes, is it possible do disable that and make ntpd simply serve 

the time that the RTC has to the clients. I want then to sync the RTC Module to an external

server only once in a month. is that possible?

----------

## Roman_Gruber

What i saw so far with the ntp stuff is that you can set only the software clock or both the software and the hardware clock.

date vs hwclock command

i use the following, => /etc/ntp.conf

```
ASUS-G75VW roman # rc-update show|grep ntp

           ntp-client |      default  
```

The ntp stuff is not that bloated you should stick to the standard configs.

Also bear in mind that you have over one single day a certain drift on notebooks for example, so I doubt it will be smart to only sync it once a month. There are also leap seconds, seconds which are inserted, which are not covered by the hwclock for example ...

You may look in the manpage for ntp and also check those examples on the net for ntp.

a bit off topic: I had with my notebook a drift of several minutes over ~1-3 weeks. The other notebook which I sold had an issue with wrong clock on a random basis. so ntp keeps your files at a correct timestamp which is important for troubleshooting. Quite annoying when your box tells you for example, file system check enforced on ext3 because files in the future were found and such nonsense

I recommend that you go with the standard settings as this "daemon" service is very slim and leightweight

--

you can set up for sure your own ntp-server if desired

----------

## szatox

 *Quote:*   

>  correct the drift and sets the swclock (and not hwclock)

 

Software and hardware clock refer each other. Many systems use software clocks when they are powered on, fix hardware clock on shutdown, let it run when powered off, and then read the results back to software when they boot.

Other systems always use hardware, and some others cut the costs and do that in software only.

 *Quote:*   

> Ntpd is running on it and serves the time
> 
> among my local clients. I do not fully understand how and what time is served
> 
> from ntpd. 

 Thsi depends on the time source you have. Since you only said about pi, I assume it's just a cheap (And not very accurate) clock. In this case you should synchronize with remote time servers, adjust your clock, and THEN serve it to other machines in your network.

It's quite different when you plug a GPS receiver though: those things allow you to synchronize with incredibly accurate atomic clocks running aboard the satellites. Using this signal for a source you can be sure your pi's time will be more accurately adjusted than whatever you can get from remote servers.

Not that it actually mattered, for YOUR builtin clock is not accurate enough to notice  :Smile: 

If you want to know how the time is served, you may consider running wireshark (or any other sniffer) on port 123. It's not very verbose.

----------

## dasPaul

The reason I want this is simply I dont want each client in the subnet to connect to an external ntp server on boot but instead only

to my RPi.

I think I will do some test to see what drift I have to expect from the RPi's swclock vs. hwclock over time. My RTC Module

is a DS3231 which seems to be "quite" accurate (not compared to GPS clocks).  

Well actually the RTC Module is a bit meaningless if ntpd is running, because ntpd syncs swclock to external servers when it "thinks" the drift is to high. 

I'll read a bit more through the docs. So far thanks for your thoughts.

----------

