diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-04-25 06:00:13 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:25:46 +0200 |
commit | 8841ea78fd3386118c7514c89c22fae057cc151a (patch) | |
tree | a5f45e845465b72d5b47c9705111a5adf4a7e888 /src | |
parent | 96469ee44afb7a31157d1653c172fc11f47d675c (diff) |
Improve database startup by moving timestamp sync to where it's needed
Diffstat (limited to 'src')
-rw-r--r-- | src/Database.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/Database.cpp b/src/Database.cpp index 383cc18..d4ae190 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -132,11 +132,6 @@ namespace odhtdb if(ntpThread->joinable()) ntpThread->detach(); } - - while(!timestampSynced) - { - this_thread::sleep_for(10ms); - } } Database::~Database() @@ -438,7 +433,10 @@ namespace odhtdb ntp::NtpTimestamp Database::getSyncedTimestampUtc() const { - assert(timestampSynced); + while(!timestampSynced) + { + this_thread::sleep_for(10ms); + } ntp::NtpTimestamp timestamp; timestamp.seconds = time(nullptr) - timeOffset; timestamp.fractions = 0; // TODO: Set this |