Whenever a computer wants to sync its internal clock, usually right around reboot, it'll check in with a time server. This is built-in functionality that spans across every modern OS.
Now, in some cases you might have a reason to disable the time check - and that's fine.
However, if you were Paul M., you might find that your admin had implemented a third option in the form of the below script that he uncovered while hunting down a shell script bug.
DATE=`wget -T 3 -t 5 -S --no-check-certificate https://www.example.com/default.css -O /dev/null 2>&1 | grep Date | awk '{ print $3 " " $4 " " $5 " " $6 " " $7 " " $8 }' 2>/dev/null` date -s "$DATE" >/dev/null hwclock -uw >/dev/null
To break it down, here's the result of the wget:
mbowytz@mbowytz-PC ~ $ wget -T 3 -t 5 -S --no-check-certificate https://www.example.com/default.css -O /dev/null --2014-10-22 08:00:07-- https://www.example.com/default.css Resolving www.example.com (www.example.com)... 93.184.216.119, 2606:2800:220:6d:26bf:1447:1097:aa7 Connecting to www.example.com (www.example.com)|93.184.216.119|:443... connected. The certificate's owner does not match hostname ‘www.example.com’ HTTP request sent, awaiting response... HTTP/1.1 404 Not Found Accept-Ranges: bytes Cache-Control: max-age=604800 Content-Type: text/html Date: Wed, 22 Oct 2014 12:00:12 GMT Etag: "359670651" Expires: Wed, 29 Oct 2014 12:00:12 GMT Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT Server: ECS (iad/19BF) X-Cache: 404-HIT x-ec-custom-error: 1 Content-Length: 0 2014-10-22 08:00:07 ERROR 404: Not Found.
That result is then grepped for the text "Date" to get the current GMT date and then use awk to extract the 3rd through the 8th data fields so that the result is in DD Mon YYYY HH:MM:SS GMT. Oh, and there's no 8th field, but on the bright side - it works.