diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-11-16 10:27:01 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 10:27:01 +0900 |
commit | 7777024dab402b780472daf1ceb6afb3460b388d (patch) | |
tree | f08cd702577d8962e25fbe8f7a6d3699da16656f /src/libsystemd/sd-event | |
parent | d068f3a243f9b5153fdcaa966e0f456637306832 (diff) | |
parent | 6706ce2fd2a13df0ae5e469b72d688eaf643dac4 (diff) | |
download | systemd-7777024dab402b780472daf1ceb6afb3460b388d.tar.gz |
Merge pull request #21344 from yuwata/network-ignore-carrier-loss-timespan
network: make IgnoreCarrierLoss= also take a timespan
Diffstat (limited to 'src/libsystemd/sd-event')
-rw-r--r-- | src/libsystemd/sd-event/event-util.c | 24 | ||||
-rw-r--r-- | src/libsystemd/sd-event/event-util.h | 26 |
2 files changed, 46 insertions, 4 deletions
diff --git a/src/libsystemd/sd-event/event-util.c b/src/libsystemd/sd-event/event-util.c index 132796fc6c..0e53406a94 100644 --- a/src/libsystemd/sd-event/event-util.c +++ b/src/libsystemd/sd-event/event-util.c @@ -84,6 +84,30 @@ int event_reset_time( return created; } +int event_reset_time_relative( + sd_event *e, + sd_event_source **s, + clockid_t clock, + uint64_t usec, + uint64_t accuracy, + sd_event_time_handler_t callback, + void *userdata, + int64_t priority, + const char *description, + bool force_reset) { + + usec_t usec_now; + int r; + + assert(e); + + r = sd_event_now(e, clock, &usec_now); + if (r < 0) + return log_debug_errno(r, "sd-event: Failed to get the current time: %m"); + + return event_reset_time(e, s, clock, usec_add(usec_now, usec), accuracy, callback, userdata, priority, description, force_reset); +} + int event_source_disable(sd_event_source *s) { if (!s) return 0; diff --git a/src/libsystemd/sd-event/event-util.h b/src/libsystemd/sd-event/event-util.h index c8f97bc8d6..64a4199244 100644 --- a/src/libsystemd/sd-event/event-util.h +++ b/src/libsystemd/sd-event/event-util.h @@ -5,9 +5,27 @@ #include "sd-event.h" -int event_reset_time(sd_event *e, sd_event_source **s, - clockid_t clock, uint64_t usec, uint64_t accuracy, - sd_event_time_handler_t callback, void *userdata, - int64_t priority, const char *description, bool force_reset); +int event_reset_time( + sd_event *e, + sd_event_source **s, + clockid_t clock, + uint64_t usec, + uint64_t accuracy, + sd_event_time_handler_t callback, + void *userdata, + int64_t priority, + const char *description, + bool force_reset); +int event_reset_time_relative( + sd_event *e, + sd_event_source **s, + clockid_t clock, + uint64_t usec, + uint64_t accuracy, + sd_event_time_handler_t callback, + void *userdata, + int64_t priority, + const char *description, + bool force_reset); int event_source_disable(sd_event_source *s); int event_source_is_enabled(sd_event_source *s); |