LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware - ARM (https://www.linuxquestions.org/questions/slackware-arm-108/)
-   -   sntp is not consistent on Raspberry Pi (https://www.linuxquestions.org/questions/slackware-arm-108/sntp-is-not-consistent-on-raspberry-pi-4175529724/)

ChrisAbela 01-01-2015 07:30 AM

sntp is not consistent on Raspberry Pi
 
I am running an RPi with a FatDog installer. sntp is not consistent, probably since the last ntp update from slackwarearm.

I edited /etc/rc.d/rc.local to call ntpdate instead:

Quote:

echo "Setting the time:"
echo " /usr/sbin/ntpdate pool.ntp.org > /dev/null &"
/usr/sbin/ntpdate pool.ntp.org > /dev/null &

DarrenDrapkin 01-08-2015 10:30 AM

I do not have a Pi but,I think that this is a hardware problem. The Pi, as far as I know, does not have a real time clock,leading all automated time programmes to fail. Someone tell me that I'm wrong.

ChrisAbela 01-08-2015 02:34 PM

Quote:

I do not have a Pi but,I think that this is a hardware problem. The Pi, as far as I know, does not have a real time clock,leading all automated time programmes to fail. Someone tell me that I'm wrong.
You are correct, the RPi does not have an RTC. I am using ntpdate to set the system time. Previously I used sntp, which now does not always work.

Chris

justwantin 01-10-2015 04:33 AM

The FatDog install image should not be the issue, it is only an installer image. What was the problem with sntp? you told us what you were using instead of sntp, but what was the output from sntp that seemed inconsistant? I have had no problems with it running 14.1 and current (November 2014).

ChrisAbela 01-10-2015 02:14 PM

Quote:

What was the problem with sntp? you told us what you were using instead of sntp, but what was the output from sntp that seemed inconsistant? I have had no problems with it running 14.1 and current (November 2014).
You may note thay sntp fails, but after I set the time via ntpdate, sntp runs correctly:

Quote:

root@raspberrypi:~# /usr/sbin/sntp -s it.pool.ntp.org
sntp 4.2.8@1.3265-o Fri Dec 26 17:54:55 UTC 2014 (1)
1970-01-01 01:02:35.190286 (-0100) +1420920081.06499 +/- 947280054.077984 it.pool.ntp.org 62.48.53.90 s2
adj_systime: Invalid argument
root@raspberrypi:~# /usr/sbin/ntpdate it.pool.ntp.org
10 Jan 21:04:13 ntpdate[739]: step time server 62.48.53.90 offset 1420920080.995730 sec
You have mail in /var/spool/mail/root
root@raspberrypi:~# /usr/sbin/sntp -s it.pool.ntp.org
sntp 4.2.8@1.3265-o Fri Dec 26 17:54:55 UTC 2014 (1)
2015-01-10 21:04:24.930491 (-0100) +0.000152 +/- 0.055694 it.pool.ntp.org 212.121.88.250 s3
root@raspberrypi:~#

justwantin 01-12-2015 05:56 AM

Well... there may be a difference with what you and I are doing...........

I use the following, called from a script in /etc/wicd/scripts/postconnect.
Code:

/usr/sbin/sntp -s pool.ntp.org
Every time a Pi boots and wicd kicks in the Pi has has the correct time.

louigi600 01-13-2015 06:18 AM

I use this on all my systems to put the time right (even when it's way off):
Code:

ntpdate -b pool.ntp.org
I even do that before starting ntpd (on the systems where that's configured) just to make sure that ntpd reaches working statum as quickly as possible.
On system where there is a working hardware clock al also do this
Code:

hwclock -w
after having synced with pool.ntp.org.

lazardo 03-30-2018 01:12 PM

Actually a step/slew issue, settimeofday is the correct choice:
Code:

sntp -S 3.us.pool.ntp.org
Now I won't forget ;)

Penthux 04-02-2018 02:06 AM

Quote:

Originally Posted by louigi600 (Post 5300177)
I use this on all my systems to put the time right (even when it's way off)

On a Slackware ARM system I'd use this;
Code:

root@slackware:~# ntpdate -b 0.pool.ntp.org
Or this;
Code:

root@slackware:~# ntpd -b 0.pool.ntp.org
When no network connection is available I'd set the date/time manually and use this;
(Example used is midday on Sunday, April 01 2018)
Code:

root@slackware:~# date 040112002018.00
Or this;
Code:

root@slackware:~# date -s "Sun Apr 01 12:00:00 2018"
If accurate time is always a consideration then I'd recommend to setup a Raspberry Pi as a NTP server. If you have a spare RPi device laying around it would be a perfect use for it. I did exactly that and use this RPi to set the date/time on all my computer systems around the house.

Code:

root@vuur:~# ntpq -p
    remote          refid      st t when poll reach  delay  offset  jitter
==============================================================================
 LOCAL(0)        .LOCL.          10 l 115d  64    0    0.000    0.000  0.000
 192.168.10.71  .XFAC.          16 B    -  64    0    0.000    0.000  0.004
*glfd-dmzutil-1. 10.178.1.162    2 u 1073 1024  377  24.842  -2.101  2.248
+ntp0.nl.uu.net  .GPS.            1 u  793 1024  377  19.515  -0.450  0.976
-turnip.mc.man.a 193.62.22.74    2 u  919 1024  377  31.140  -1.059  0.737
+139.59.199.215  82.69.223.180    2 u 1018 1024  377  20.305  -3.778  1.318

root@vuur:~# date
Mon Apr  2 07:49:17 BST 2018

From another system on the network I just do this:

Code:

root@drie:~# ntpdate -b 192.168.10.71
 2 Apr 07:50:09 ntpdate[4179]: step time server 192.168.10.71 offset 0.002963 sec
root@drie:~# date
Mon Apr  2 07:50:16 BST 2018

I have a slight addiction to RTCs and have collected quite a sum of them over the years. Of which, I've found the DS3231 to be the best by far and have them installed in almost all my RPis. A real time clock is always good for a back-up solution, whether it's ever needed or not.

"Time is the school in which we learn,
Time is the fire in which we burn.
"
[Delmore Schwartz]


All times are GMT -5. The time now is 11:08 PM.