ubxtool.cc: Use monotonic clock for uptime calculation.

pull/109/head
Phil Crump 2020-02-22 23:24:00 +00:00
parent 62c06629ff
commit 4095e911d8
1 changed files with 2 additions and 2 deletions

View File

@ -565,7 +565,7 @@ int initFD(const char* fname, bool doRTSCTS)
// 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);
@ -1629,7 +1629,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);