" <interface name=\"org.freedesktop.timedate1\">\n" \
" <property name=\"Timezone\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"LocalRTC\" type=\"b\" access=\"read\"/>\n" \
+ " <property name=\"CanNTP\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"NTP\" type=\"b\" access=\"read\"/>\n" \
" <method name=\"SetTime\">\n" \
" <arg name=\"usec_utc\" type=\"x\" direction=\"in\"/>\n" \
typedef struct TZ {
char *zone;
bool local_rtc;
+ int can_ntp;
int use_ntp;
} TZ;
static TZ tz = {
+ .can_ntp = -1,
.use_ntp = -1,
};
goto finish;
}
+ tz.can_ntp = 1;
tz.use_ntp =
streq(s, "enabled") ||
streq(s, "enabled-runtime");
}
/* NTP is not installed. */
+ tz.can_ntp = 0;
tz.use_ntp = 0;
r = 0;
return r;
}
+static int property_append_can_ntp(DBusMessageIter *i, const char *property, void *data) {
+ dbus_bool_t db;
+
+ assert(i);
+ assert(property);
+
+ db = tz.can_ntp > 0;
+
+ if (!dbus_message_iter_append_basic(i, DBUS_TYPE_BOOLEAN, &db))
+ return -ENOMEM;
+
+ return 0;
+}
+
static int property_append_ntp(DBusMessageIter *i, const char *property, void *data) {
dbus_bool_t db;
static const BusProperty bus_timedate_properties[] = {
{ "Timezone", bus_property_append_string, "s", offsetof(TZ, zone), true },
{ "LocalRTC", bus_property_append_bool, "b", offsetof(TZ, local_rtc) },
+ { "CanNTP", property_append_can_ntp, "b", offsetof(TZ, can_ntp) },
{ "NTP", property_append_ntp, "b", offsetof(TZ, use_ntp) },
{ NULL, }
};