Recently I had to synchronize time between servers. I usually use ntp (Network Time Protocol) or tlsdate but in that case I couldn’t use that. Furthermore server did not have the Internet connection, so I set the time using ssh:
date -s "`ssh user@second_host 'date --rfc-3339=ns'`"
And checked:
ssh user@second_host 'date' && date
Of course there is a small delay between ssh answer and setting date, but I did not need milliseconds’ accuracy.
Leave a Reply