- log_struct(LOG_INFO,
- MESSAGE_ID(SD_MESSAGE_TIME_CHANGE),
- "REALTIME=%llu", (unsigned long long) timespec_load(&ts),
- "MESSAGE=Changed local time to %s", ctime(&ts.tv_sec),
- NULL);
- }
- } else if (dbus_message_is_method_call(message, "org.freedesktop.timedate1", "SetNTP")) {
- dbus_bool_t ntp;
- dbus_bool_t interactive;
-
- if (!dbus_message_get_args(
- message,
- &error,
- DBUS_TYPE_BOOLEAN, &ntp,
- DBUS_TYPE_BOOLEAN, &interactive,
- DBUS_TYPE_INVALID))
- return bus_send_error_reply(connection, message, &error, -EINVAL);
-
- if (ntp != !!tz.use_ntp) {
-
- r = verify_polkit(connection, message, "org.freedesktop.timedate1.set-ntp", interactive, NULL, &error);
- if (r < 0)
- return bus_send_error_reply(connection, message, &error, r);
-
- tz.use_ntp = !!ntp;
-
- r = enable_ntp(connection, &error);
- if (r < 0)
- return bus_send_error_reply(connection, message, &error, r);
-
- r = start_ntp(connection, &error);
- if (r < 0)
- return bus_send_error_reply(connection, message, &error, r);
-
- log_info("Set NTP to %s", tz.use_ntp ? "enabled" : "disabled");
-
- changed = bus_properties_changed_new(
- "/org/freedesktop/timedate1",
- "org.freedesktop.timedate1",
- "NTP\0");
- if (!changed)
- goto oom;
- }