The only obvious way to do this is using NTP. I tried using the ntp_client library written by Michael Margolis and using configtime() but both these approaches result in a time about two seconds slow.
Keeping the time is no issue but I cannot set it sufficiently accurately.