summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2022-10-31 20:46:26 +0900
committerJaehyun Kim <jeik01.kim@samsung.com>2022-10-31 20:46:26 +0900
commit8a2395563cbaef0b56da21d56df2eea10a2c3c20 (patch)
tree345c7628ee1c1274550ddd9392380aa81bb60bcd
parent1b51089be8aa24e08ef87e895d9093ae62426004 (diff)
downloadconnman-8a2395563cbaef0b56da21d56df2eea10a2c3c20.tar.gz
connman-8a2395563cbaef0b56da21d56df2eea10a2c3c20.tar.bz2
connman-8a2395563cbaef0b56da21d56df2eea10a2c3c20.zip
DA: Add exception check for time logic
1. Ignore next time server if current time server string is empty. 2. Check time_updates_config before set time. Change-Id: Ifd617686b9eb25d75350d0af3a0f592c7d85ffed Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
-rwxr-xr-xsrc/clock.c26
-rwxr-xr-xsrc/ntp.c7
-rwxr-xr-xsrc/timeserver.c7
3 files changed, 39 insertions, 1 deletions
diff --git a/src/clock.c b/src/clock.c
index 58a52c0e..54552cab 100755
--- a/src/clock.c
+++ b/src/clock.c
@@ -119,6 +119,17 @@ static void clock_properties_load(void)
g_free(str);
+#if defined TIZEN_EXT
+ str = g_key_file_get_string(keyfile, "global", "Timeservers", NULL);
+
+ if (str && str[0] == ';') {
+ DBG("Set time_updates_config to MANUAL.");
+ time_updates_config = TIME_UPDATES_MANUAL;
+ }
+
+ g_free(str);
+#endif
+
g_key_file_free(keyfile);
}
@@ -387,6 +398,21 @@ static DBusMessage *set_property(DBusConnection *conn,
__connman_timeserver_system_set(str);
+#if defined TIZEN_EXT
+ if (str) {
+ if (str[0][0] == '\0') {
+ DBG("Set time_updates_config to MANUAL.");
+ time_updates_config = TIMEZONE_UPDATES_MANUAL;
+ } else {
+ DBG("Set time_updates_config to AUTO.");
+ time_updates_config = TIMEZONE_UPDATES_AUTO;
+ }
+ } else {
+ DBG("Set time_updates_config to MANUAL.");
+ time_updates_config = TIMEZONE_UPDATES_MANUAL;
+ }
+#endif
+
if (str)
g_strfreev(str);
diff --git a/src/ntp.c b/src/ntp.c
index 0de4df75..22187488 100755
--- a/src/ntp.c
+++ b/src/ntp.c
@@ -527,6 +527,13 @@ static gboolean received_data(GIOChannel *channel, GIOCondition condition,
}
}
+#if defined TIZEN_EXT
+ if (__connman_clock_timeupdates() == TIME_UPDATES_MANUAL) {
+ DBG("Skip time update.");
+ return TRUE;
+ }
+#endif
+
decode_msg(nd, iov.iov_base, iov.iov_len, tv, &mrx_time);
return TRUE;
diff --git a/src/timeserver.c b/src/timeserver.c
index b2707fad..2df609f3 100755
--- a/src/timeserver.c
+++ b/src/timeserver.c
@@ -206,7 +206,12 @@ static void sync_next(void)
return;
}
#if defined TIZEN_EXT
- if (!simplified_log)
+ if (ts_current[0] == '\0') {
+ DBG("current time server is empty. ignore next time server..");
+ return;
+ }
+
+ if (!simplified_log)
#endif
DBG("Resolving timeserver %s", ts_current);
#if defined TIZEN_EXT