timeout: no volatile stackvars, better warnings

This commit is contained in:
Martin Stein 2020-10-26 22:56:34 +01:00 committed by Christian Helmuth
parent dff3bac441
commit 89d28c8222
2 changed files with 7 additions and 4 deletions

View File

@ -53,7 +53,7 @@ uint64_t Timer::Connection::_ts_to_us_ratio(Timestamp ts,
*/
static unsigned nr_of_warnings { 0 };
if (nr_of_warnings++ % 1000 == 0) {
warning("timestamp value too big");
warning("timestamp value too big, ts=", ts, " max_ts=", max_ts);
}
while (ts > max_ts) {
ts >>= 1;

View File

@ -41,8 +41,8 @@ void Timer::Connection::_update_real_time()
remote_time_trials < MAX_REMOTE_TIME_TRIALS; ) {
/* read out the two time values close in succession */
Timestamp volatile new_ts = _timestamp();
uint64_t volatile new_us = elapsed_us();
Timestamp const new_ts = _timestamp();
uint64_t const new_us = elapsed_us();
/* do not proceed until the time difference is at least 1 us */
if (new_us == _us || new_ts == _ts) { continue; }
@ -99,7 +99,10 @@ void Timer::Connection::_update_real_time()
/* if possible, lower the shift to meet the limitation */
if (!factor_shift) {
error("timestamp difference too big");
error("timestamp difference too big, ts_diff=", ts_diff,
" max_ts_diff=", max_ts_diff);
throw Factor_update_failed();
}
factor_shift--;