diff options
-rw-r--r-- | src/core/dbus-timer.c | 6 | ||||
-rw-r--r-- | src/shared/bus-util.c | 28 |
2 files changed, 15 insertions, 19 deletions
diff --git a/src/core/dbus-timer.c b/src/core/dbus-timer.c index ec301df6d7..212f9e1d8d 100644 --- a/src/core/dbus-timer.c +++ b/src/core/dbus-timer.c @@ -267,10 +267,12 @@ static int bus_timer_set_transient_property( return 1; - } else if (streq(name, "AccuracySec")) { - + } else if (STR_IN_SET(name, "AccuracyUSec", "AccuracySec")) { usec_t u = 0; + if (streq(name, "AccuracySec")) + log_notice("Client is using obsolete AccuracySec= transient property, please use AccuracyUSec= instead."); + r = sd_bus_message_read(message, "t", &u); if (r < 0) return r; diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index 63fd9b9514..3afe157905 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -1459,18 +1459,22 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen return 0; - } else if (streq(field, "RandomizedDelaySec")) { + } else if (STR_IN_SET(field, "AccuracySec", "RandomizedDelaySec")) { + char *n; usec_t t; - + size_t l; r = parse_sec(eq, &t); if (r < 0) - return log_error_errno(r, "Failed to parse RandomizedDelaySec= parameter: %s", eq); + return log_error_errno(r, "Failed to parse %s= parameter: %s", field, eq); - r = sd_bus_message_append_basic(m, SD_BUS_TYPE_STRING, "RandomizedDelayUSec"); - if (r < 0) - return bus_log_create_error(r); + l = strlen(field); + n = newa(char, l + 2); + if (!n) + return log_oom(); - r = sd_bus_message_append(m, "v", "t", t); + /* Change suffix Sec → USec */ + strcpy(mempcpy(n, field, l - 3), "USec"); + r = sd_bus_message_append(m, "sv", n, "t", t); if (r < 0) return bus_log_create_error(r); @@ -1746,16 +1750,6 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen r = sd_bus_message_append(m, "v", "i", sig); - } else if (streq(field, "AccuracySec")) { - usec_t u; - - r = parse_sec(eq, &u); - if (r < 0) { - log_error("Failed to parse %s value %s", field, eq); - return -EINVAL; - } - - r = sd_bus_message_append(m, "v", "t", u); } else if (streq(field, "TimerSlackNSec")) { nsec_t n; |