Sync Laravel Homestead server time

When developing laravel projects in Homestead the server time can sometimes slowly skew off and not reflect the date and time the local machine. This an be a problem, especially when working with 3rd party apis which sign request using the server time. If the times don’t match then requests often fail.

To reset the Homestead time back to reality the following command be used:

sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"