diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-11-18 13:37:30 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-11-18 17:07:11 +0100 |
commit | 744c7693751830149ae78fdaf95c6c6f99d59f07 (patch) | |
tree | 5de31e8948b3d625f22f2c9cc4e6202f9b58f935 /src/shared | |
parent | 45090bf2ff43217116fc2497b4442320dffabf86 (diff) |
core: add new RandomSec= setting for time units
This allows configuration of a random time on top of the elapse events,
in order to spread time events in a network evenly across a range.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/bus-util.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index dab4934901..38281045b8 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -1442,6 +1442,23 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen return bus_log_create_error(r); return 0; + + } else if (streq(field, "RandomSec")) { + usec_t t; + + r = parse_sec(eq, &t); + if (r < 0) + return log_error_errno(r, "Failed to parse RandomSec= parameter: %s", eq); + + r = sd_bus_message_append_basic(m, SD_BUS_TYPE_STRING, "RandomUSec"); + if (r < 0) + return bus_log_create_error(r); + + r = sd_bus_message_append(m, "v", "t", t); + if (r < 0) + return bus_log_create_error(r); + + return 0; } r = sd_bus_message_append_basic(m, SD_BUS_TYPE_STRING, field); |