diff --git a/core/consensus/babe/impl/block_header_appender_impl.cpp b/core/consensus/babe/impl/block_header_appender_impl.cpp index d6f37565ef..eff5655b04 100644 --- a/core/consensus/babe/impl/block_header_appender_impl.cpp +++ b/core/consensus/babe/impl/block_header_appender_impl.cpp @@ -136,6 +136,9 @@ namespace kagome::consensus::babe { block_info.number - self->speed_data_.block_number; auto const time_delta = now - self->speed_data_.time; if (block_delta >= 10000 or time_delta >= std::chrono::minutes(1)) { + const auto td = + std::chrono::duration_cast(time_delta) + .count(); SL_LOG(self->logger_, self->speed_data_.block_number ? log::Level::INFO : static_cast(-1), @@ -144,10 +147,7 @@ namespace kagome::consensus::babe { block_delta, self->speed_data_.block_number, block_info.number, - block_delta - / std::chrono::duration_cast( - time_delta) - .count()); + td != 0ull ? block_delta / td : 0ull); self->speed_data_.block_number = block_info.number; self->speed_data_.time = now; }