Please find attached as a pet the htpdate utility compiled for the most
recent slacko-700 and ScPup-19.01 (at the time of this writing).
It may or may not be suited for other Pups, since this exec requires
GNU libc version 2.28 to work. Please check the ldd version in your Pup,
like so: open a console and type in it:
Code: Select all
ldd --version
I tested it thoroughly (I think), but use at your own peril, as usual.
Please take a minute to read the NOTE in the script below and call the
htpdate man page if you need more info. Or leave your question below.
Enjoy.
~~~~~~~~~~~~
Code: Select all
#!/bin/bash
MBINS=/root/my-applications/bin
[ ! -d $MBINS ] && MBINS=/opt/local/bin
# $MBINS/htpdate.sh
# With link in: / Avec lien dans : /root/Startup
#
# Goal: Synchronise the time and date of your Puppy with Internet
# ----- time by probing various http sites.
#
# Objectif : Synchroniser le temps et l'heure de votre Toutou ou
# ---------- Puppy en sondant divers sites http.
#
# Please read the NOTE below. / S.v.p. lire la NOTE ci-dessous.
#
# (c) musher0, Gatineau (Qc), Canada, 27 décembre 2018. GPL3.
####
[ -f /root/root/last-date ] && date --set="`cat /root/last-date`" || date --set="20181227 14:28"
sleep 2s
htpdate -as www.linux.org www.freebsd.org www.ask.com unix.stackexchange.com puppylinux.com www.gnu.org www.cnrs.fr www.assnat.qc.ca www.parl.ca
date > /root/last-date
exit
~~~~~~~~~~~~~~
~~ NOTE ~~
~~~~~~~~~~~
Replaces /usr/local/ptimesync and /root/Startup/timesync.sh
(please remove or store out of the way) in slacko-700_32-bits.
As it is, this script should offer a precision between 0.6 and
0.167 of a second.
If you wish, you can test and use other public sites than
those above.
~~~~~~~~~~~~~~
Remplace /usr/local/ptimesync et /root/Startup/timesync.sh
(s.v.p. enlever ou entreproser ailleurs) dans slacko-700_32-bits.
Tel quel, le script devrait offrir une précision de 0,6 à 0,167
seconde.
Si vous le souhaitez, vous pouvez tester et utiliser d'autres
sites publics que ceux ci-dessus.
~~~~~~~~~~~~~~
-- the first line is the command itself;
-- the second line is the date and time in file "last-date";
-- the third line is the update from "last-date";
-- the fourth line is the new current time and date.
AFAICT, htpdate gives an error if you start it on a computer with a dead
battery. Please correct me if I'm wrong, but htpdate does not seem to be
able to recognize old dates such as "Jan. 3 1980, 00:01 hr".
As a workaround, I devised the following:
The fictitious relatively recent date contained in file "last-date" is fed into
the OS by command < date --set="`cat /root/last-date`" >. If file
"last-date" does not exist it is created. Then htpdate updates from that
time and date. That way, it's easier on the girl!
IHTH.