Replace C-style clock() with std::chrono::steady_clock to fix timing on Linux
This commit is contained in:
parent
5aad79135f
commit
ad4e198aea
4 changed files with 8 additions and 7 deletions
|
|
@ -65,7 +65,7 @@ void CorsairLightingNodeController::KeepaliveThread()
|
|||
{
|
||||
while(1)
|
||||
{
|
||||
if((clock() - last_commit_time) > 5000)
|
||||
if((std::chrono::steady_clock::now() - last_commit_time) > std::chrono::seconds(5))
|
||||
{
|
||||
SendCommit();
|
||||
}
|
||||
|
|
@ -271,7 +271,7 @@ void CorsairLightingNodeController::SendCommit()
|
|||
/*-----------------------------------------------------*\
|
||||
| Update last commit time |
|
||||
\*-----------------------------------------------------*/
|
||||
last_commit_time = clock();
|
||||
last_commit_time = std::chrono::steady_clock::now();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Commit packet |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue