Convert a date string for date or systemsetup command
To properly set a more or less current system date and time with date and wget use:

sudo date -f "%d %b %Y %H:%M:%S %Z" "$(wget -qSO- --max-redirect=0 google.com 2&gt;&amp;1 | grep Date: | cut -d' ' -f5-9)"


Using ... cut -d' ' -f5-8)" (see your comment) will omit the time zone and you would have to add 1 or 2 hours depending on the state of the day light saving time to adjust your local time.

The result of wget -qSO- --max-redirect=0 google.com 2&gt;&amp;1 | grep Date: | cut -d' ' -f5-9 is something like 12 May 2017 12:17:00 GMT.

So the date/time format of the date command to set date/time has to be %d %b %Y %H:%M:%S %Z. Since May is the short as well as the long name of the month and we don't really know the format of the month's name in Google's reply, %b may have to be replaced by %B in June :-).



Due to retention and other deficiencies this is not very accurate and the ∂ is up to 3.5 seconds (usually 0.32 seconds here) compared to the time received via ntp.

To get rid of the sntp error mentioned in your comment, do the following:

sudo touch /var/db/ntp-kod
sudo chmod 666 /var/db/ntp-kod


Now sntp fr.pool.ntp.org and sudo sntp -s fr.pool.ntp.org should work.