Clock accurate tick function