Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 10 lines (7 sloc) 331 Bytes
#!/bin/bash
(( UID == 0 )) || { echo "Error: Must be root!"; exit 1; }>&2
printf "Setting hwclock to localtime from time.nist.gov...\n"
hwclock --set --date="$(awk 'NF > 1 {print $2,$3,"UTC"}' < /dev/tcp/time.nist.gov/13)" || exit 1
printf "Sync'ing hwclock to system...\n"
hwclock -s
printf "The time is now: %s\n" "$(hwclock)"