From: Davin McCall Date: Fri, 9 Nov 2018 21:05:46 +0000 (+0000) Subject: Avoid 2nd call to get current time when starting process. X-Git-Tag: v0.5.0~27 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0dc4b7555032c10d9c1ec676a46e5af17fb3a674;p=oweals%2Fdinit.git Avoid 2nd call to get current time when starting process. --- diff --git a/src/baseproc-service.cc b/src/baseproc-service.cc index 1a2be98..e9cfa2c 100644 --- a/src/baseproc-service.cc +++ b/src/baseproc-service.cc @@ -41,10 +41,11 @@ bool base_process_service::bring_up() noexcept return false; } - event_loop.get_time(restart_interval_time, clock_type::MONOTONIC); restart_interval_count = 0; if (start_ps_process(exec_arg_parts, onstart_flags.starts_on_console || onstart_flags.shares_console)) { + // start_ps_process updates last_start_time, use it also for restart_interval_time: + restart_interval_time = last_start_time; // Note: we don't set a start timeout for PROCESS services. if (start_timeout != time_val(0,0) && get_type() != service_type_t::PROCESS) { restart_timer.arm_timer_rel(event_loop, start_timeout); @@ -56,6 +57,7 @@ bool base_process_service::bring_up() noexcept } return true; } + restart_interval_time = last_start_time; return false; } }