Merge pull request #109 from philcrump/phil-fix-uptime

ubxtool.cc: Use monotonic clock for uptime calculation.
pull/142/head
berthubert 2020-10-13 21:47:56 +02:00 committed by GitHub
commit 4b8fd97dca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -496,7 +496,7 @@ struct TIMEGPS
// ubxtool device srcid
int main(int argc, char** argv)
{
time_t starttime=time(0);
auto starttime = std::chrono::steady_clock::now();
GOOGLE_PROTOBUF_VERIFY_VERSION;
CLI::App app(program);
@ -1703,7 +1703,7 @@ int main(int argc, char** argv)
nmm.mutable_od()->set_owner(owner);
nmm.mutable_od()->set_remark(remark);
nmm.mutable_od()->set_recvgithash(g_gitHash);
nmm.mutable_od()->set_uptime(time(0) - starttime);
nmm.mutable_od()->set_uptime(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now()-starttime).count());
ns.emitNMM( nmm);