Skip to content

Commit 8453012

Browse files
authored
fix recording_fist_time issue on windows (#618)
1 parent c0c49a8 commit 8453012

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/loggers/groot2_publisher.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -426,12 +426,13 @@ void Groot2Publisher::serverLoop()
426426
if(cmd == "start")
427427
{
428428
_p->recording = true;
429-
auto now = std::chrono::system_clock::now();
430-
431-
_p->recording_fist_time = std::chrono::duration_cast<std::chrono::microseconds>
432-
(now.time_since_epoch());
433-
434-
reply_msg.addstr(std::to_string(_p->recording_fist_time.count()));
429+
// to keep the first time for callback
430+
_p->recording_fist_time = std::chrono::duration_cast<std::chrono::microseconds>(
431+
std::chrono::high_resolution_clock::now().time_since_epoch());
432+
// to send consistent time for client
433+
auto now = std::chrono::duration_cast<std::chrono::microseconds>(
434+
std::chrono::system_clock::now().time_since_epoch());
435+
reply_msg.addstr(std::to_string(now.count()));
435436
std::unique_lock<std::mutex> lk(_p->status_mutex);
436437
_p->transitions_buffer.clear();
437438
}

0 commit comments

Comments
 (0)