Fix integer overflow in THROTTLE first call
Initializing m_last to time_point::min() causes signed integer overflow when computing now - m_last, since the nanosecond difference exceeds int64_t range. Initialize to now - interval instead so the first Ready() call passes naturally.
This commit is contained in:
@@ -36,7 +36,7 @@ class THROTTLE
|
||||
public:
|
||||
explicit THROTTLE( std::chrono::milliseconds aInterval ) :
|
||||
m_interval( aInterval ),
|
||||
m_last( std::chrono::steady_clock::time_point::min() )
|
||||
m_last( std::chrono::steady_clock::now() - aInterval )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user