diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-07-04 19:10:11 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-07-04 19:12:47 +0200 |
commit | 1f65fd4926c5b88db770c1b47a0b0a24c2319d12 (patch) | |
tree | 3ff3c0268a5d02aa96fcde241816fcb2bf7b6e02 /src/core | |
parent | 7810d22171bbff1301397357afd4146016a60bde (diff) | |
download | systemd-1f65fd4926c5b88db770c1b47a0b0a24c2319d12.tar.gz |
basic/time-util: add helper function to check if timestamp is set
No functional change.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/job.c | 2 | ||||
-rw-r--r-- | src/core/main.c | 2 | ||||
-rw-r--r-- | src/core/manager.c | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/core/job.c b/src/core/job.c index 81f5f9cb72..df7eacfbc0 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -1347,7 +1347,7 @@ int job_coldplug(Job *j) { if (j->unit->job_timeout != USEC_INFINITY) timeout_time = usec_add(j->begin_usec, j->unit->job_timeout); - if (j->begin_running_usec > 0 && j->unit->job_running_timeout != USEC_INFINITY) + if (timestamp_is_set(j->begin_running_usec)) timeout_time = MIN(timeout_time, usec_add(j->begin_running_usec, j->unit->job_running_timeout)); if (timeout_time == USEC_INFINITY) diff --git a/src/core/main.c b/src/core/main.c index 04a6ff6366..f5dcfa09be 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1952,7 +1952,7 @@ static int initialize_runtime( log_warning_errno(r, "Failed to set watchdog device to %s, ignoring: %m", arg_watchdog_device); } - if (arg_runtime_watchdog > 0 && arg_runtime_watchdog != USEC_INFINITY) + if (timestamp_is_set(arg_runtime_watchdog)) watchdog_set_timeout(&arg_runtime_watchdog); } diff --git a/src/core/manager.c b/src/core/manager.c index 0c1adf2850..3ded0d96a1 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2896,7 +2896,7 @@ int manager_loop(Manager *m) { while (m->objective == MANAGER_OK) { usec_t wait_usec; - if (m->runtime_watchdog > 0 && m->runtime_watchdog != USEC_INFINITY && MANAGER_IS_SYSTEM(m)) + if (timestamp_is_set(m->runtime_watchdog) && MANAGER_IS_SYSTEM(m)) watchdog_ping(); if (!ratelimit_below(&rl)) { @@ -2927,7 +2927,7 @@ int manager_loop(Manager *m) { continue; /* Sleep for half the watchdog time */ - if (m->runtime_watchdog > 0 && m->runtime_watchdog != USEC_INFINITY && MANAGER_IS_SYSTEM(m)) { + if (timestamp_is_set(m->runtime_watchdog) && MANAGER_IS_SYSTEM(m)) { wait_usec = m->runtime_watchdog / 2; if (wait_usec <= 0) wait_usec = 1; |