Skip to content

Commit

Permalink
Handle_Signal: Sending interrupt signal, twice in 2s time interval, n…
Browse files Browse the repository at this point in the history
…ow properly exits the code.

- std::chrono::duration was measured in wrong unit
  • Loading branch information
M. Sallermann authored and M. Sallermann committed Jan 12, 2021
1 parent 9bb9b39 commit d2ebbc7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ui-cpp/utility/Handle_Signal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <chrono>
#include <memory>


struct State;
std::shared_ptr<State> extern state;

Expand All @@ -36,7 +35,8 @@ void Handle_Signal::Handle_SigInt( int sig )
system_clock::time_point t_now = system_clock::now();

// If time difference is less than 2 seconds
if( ( t_now - t_last_sigint ).count() < 2.0 )
if( std::chrono::duration_cast<std::chrono::seconds>( t_now - t_last_sigint )
< std::chrono::duration<double>( 2.0 ) )
{
Log_Send(
state.get(), Log_Level_All, Log_Sender_All, "SIGINT received! Received second time in less than 2s." );
Expand Down

0 comments on commit d2ebbc7

Please sign in to comment.