Added time synchronisation

Try to make sure that the interval runs to time. Also put logging back
in.