mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 03:34:53 +08:00
fixing unix timeouts handling ("timer_tests.short_interval" failure) (#147)
This commit is contained in:
parent
4d69fb2e41
commit
02dfff7883
@ -62,7 +62,7 @@ MillisecondTimer::MillisecondTimer (const uint32_t millis)
|
||||
int64_t tv_nsec = expiry.tv_nsec + (millis * 1e6);
|
||||
if (tv_nsec >= 1e9) {
|
||||
int64_t sec_diff = tv_nsec / static_cast<int> (1e9);
|
||||
expiry.tv_nsec %= static_cast<int>(1e9);
|
||||
expiry.tv_nsec = tv_nsec % static_cast<int>(1e9);
|
||||
expiry.tv_sec += sec_diff;
|
||||
} else {
|
||||
expiry.tv_nsec = tv_nsec;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user