RunState: Implement forward_network_time_if_applicable()

Add a central place where the decision when it's okay to update network time
to the current time (wallclock) is. It checks for pseudo_realtime and packet
source existence as well as packet source idleness.

A new const &redef allows to completely disable forwarding of network time.
This commit is contained in:
Arne Welzel 2023-03-15 15:03:17 +01:00
parent eefa0150b9
commit d4e31e7d2b
4 changed files with 80 additions and 13 deletions

View file

@ -1036,7 +1036,8 @@ SetupResult setup(int argc, char** argv, Options* zopts)
segment_logger = profiling_logger;
}
if ( ! run_state::reading_live && ! run_state::reading_traces )
if ( ! run_state::reading_live && ! run_state::reading_traces &&
id::find_const("allow_network_time_forward")->AsBool() )
// Set up network_time to track real-time, since
// we don't have any other source for it.
run_state::detail::update_network_time(util::current_time());