Better truetime init

This commit is contained in:
utkabobr
2025-04-02 01:35:16 +03:00
parent 662018834e
commit 58b24d5137
2 changed files with 8 additions and 3 deletions
@@ -40,6 +40,12 @@ public class AppBoot {
}
}
Log.d("boot", "Boot in " + (System.currentTimeMillis() - start) + "ms");
executor.shutdown();
executor = null;
pendingMain = null;
pendingTasks = null;
completed = null;
latch = null;
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
@@ -5,12 +5,11 @@ import com.instacart.library.truetime.TrueTime;
import java.io.IOException;
public class TrueTimeTask extends BootTask {
/** @noinspection BusyWait*/
public TrueTimeTask() {
super(() -> {
while (true) {
for (int i = 0; i < 2; i++) {
try {
TrueTime.build().withNtpHost("0.ru.pool.ntp.org").initialize();
TrueTime.build().withNtpHost("1.ru.pool.ntp.org").initialize();
break;
} catch (IOException ignore) {
try {