Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: onelife on November 12, 2013, 09:41:19 AM
-
Hi Guys,
I'm trying to solve the getTime.sh / ntp issue.
Currently here in South Africa the getTime.sh script does not work :(
Does anyone know how you can use getTime to access a local network ntpd server.
I have a ntp server on the network so ideally I would like to access that.
I've tried using the different "switches" -s for local and / or simply the address 192.168.1.3 with wait -w 20 but no luck.
Do you know if the getTime.sh script will actually talk to a "normal" ntpd server?
Also, another thought - It would be great if there was a way to "save" the system time at point of reboot. IOW, perhaps a way you "pipe" the date into a file and then on start, re-read the date initially from that file before even trying getTime.sh? Just a thought as that would help me on reboot when no internet is available on start up. (I know this means there will be a discrepancy in the time it takes to reboot, but this I can live with rather than the default 1970 date that gets set on startup)
Thanks in advance and chat soon :)
-
Do you know if the getTime.sh script will actually talk to a "normal" ntpd server?
No, it's making use of 'daytime' (port 13).
Also, another thought - It would be great if there was a way to "save" the system time at point of reboot. IOW, perhaps a way you "pipe" the date into a file and then on start, re-read the date initially from that file before even trying getTime.sh? Just a thought as that would help me on reboot when no internet is available on start up. (I know this means there will be a discrepancy in the time it takes to reboot, but this I can live with rather than the default 1970 date that gets set on startup)
Simply setting system time according to some external clock with the 'date' command seems like a lesser evil IMHO.
-
Heyo
Thanks for the reply - Sadly I don't have a RTC on the Pi (Yet) ... Am looking into this and will likely happen in the next few months BUT I really need to try solve the time / date issue now for a few systems I already have.
Do you know what it would take to get a ntp client working on PiCore? I see there is a tcz for the "standard TC".
Thanks again.
-
Do you know what it would take to get a ntp client working on PiCore? I see there is a tcz for the "standard TC".
1) Wait a bit
2) Create yourself
:)
-
A temporary remedy could be to download a statically linked busybox binary which should include ntpd from here:
http://busybox.net/downloads/binaries/latest/
Something like
sudo busybox-i686 ntpd -ndqp time.nist.gov
works for me, obviously tested with x86 though.
-
Another quick method could be:
sudo rdate some.time.server
At least in Core x86 rdate is included in base already, so no need to install anything.
-
ntp is running here on the Pi, I will add it to repo in a day.
-
For anyone landing on this page via Google etc, there is a simpler way of setting the time using any web server with curl and busybox:
sudo busybox date -D '%d %b %Y %H:%M:%S' -s "`curl -ks --head https://8.8.8.8 | grep '^Date:' | cut -d' ' -f 3-6`"
-
I don't think you need curl, you can send a HEAD request using nc.
-
Or even use busybox wget ??
./busybox wget -q --spider -S --no-check-certificate https://dns.google
-
Or even use busybox wget ??
./busybox wget -q --spider -S --no-check-certificate https://dns.google
Needed to redirect stderr to stdout, and readjust the spacing:
sudo busybox date -D '%d %b %Y %H:%M:%S' -s "`busybox wget -O - --spider -S --no-check-certificate https://dns.google 2>&1 | grep 'Date' | cut -d' ' -f 5-8`"
-
And you can even use the more modern way without using the backtick characters.
sudo busybox date -D '%d %b %Y %H:%M:%S' -s "$(busybox wget -q -O - --spider -S --no-check-certificate https://dns.google 2>&1 | grep 'Date' | cut -d' ' -f 5-8)"