Skip to contentSkip to conversation

clock: fix time update transition auto->manual

PATCH Superseded Ryan Smith 2 participants 3 messages Apr 18, 2022 – May 16, 2022

lore
Share & tools
lore

Ryan Smith

author
#0 lore raw

PATCH 1/1 clock: fix time update transition auto->manual

When the TimeUpdates property is changed via D-Bus from auto to manual, the change is written out to the settings state file. However, it does no modify the current service. This causes the service to continue to synchronize time even after TimeUpdates being set to manual. This patch updates the service whenever any change is made to the TimeUpdates setting.

---
 src/clock.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
src/clock.c +2 -6
index 906538ac..365c49a1 100644
@@ -290,12 +290,8 @@ static DBusMessage *set_property(DBusConnection *conn,
 				CONNMAN_CLOCK_INTERFACE, "TimeUpdates",
 				DBUS_TYPE_STRING, &strval);
 
-		if (newval == TIME_UPDATES_AUTO) {
-			struct connman_service *service;
-
-			service = connman_service_get_default();
-			__connman_timeserver_conf_update(service);
-		}
+		service = connman_service_get_default();
+		__connman_timeserver_conf_update(service);
 	} else if (g_str_equal(name, "Timezone")) {
 		const char *strval;
 
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v2 1/1 clock: fix time update transition auto->manual

When the TimeUpdates property is changed via D-Bus from auto to manual, the change is written out to the settings state file. However, it does no modify the current service. This causes the service to continue to synchronize time even after TimeUpdates being set to manual. This patch updates the service whenever any change is made to the TimeUpdates setting.

---
 src/clock.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
src/clock.c +3 -6
index 906538ac..54ac274a 100644
@@ -270,6 +270,7 @@ static DBusMessage *set_property(DBusConnection *conn,
 	} else if (g_str_equal(name, "TimeUpdates")) {
 		const char *strval;
 		enum time_updates newval;
+		struct connman_service *service;
 
 		if (type != DBUS_TYPE_STRING)
 			return __connman_error_invalid_arguments(msg);
@@ -290,12 +291,8 @@ static DBusMessage *set_property(DBusConnection *conn,
 				CONNMAN_CLOCK_INTERFACE, "TimeUpdates",
 				DBUS_TYPE_STRING, &strval);
 
-		if (newval == TIME_UPDATES_AUTO) {
-			struct connman_service *service;
-
-			service = connman_service_get_default();
-			__connman_timeserver_conf_update(service);
-		}
+		service = connman_service_get_default();
+		__connman_timeserver_conf_update(service);
 	} else if (g_str_equal(name, "Timezone")) {
 		const char *strval;
 
Signature · 1 line
2.25.1
#2 lore raw

Hi Ryan,

Quoted 5 lines · Ryan Smith

When the TimeUpdates property is changed via D-Bus from auto to manual, the change is written out to the settings state file. However, it does no modify the current service. This causes the service to continue to synchronize time even after TimeUpdates being set to manual. This patch updates the service whenever any change is made to the TimeUpdates setting.

Seems reasonable to do. Patch applied.

Thanks,
Daniel