From 8a2395563cbaef0b56da21d56df2eea10a2c3c20 Mon Sep 17 00:00:00 2001 From: Jaehyun Kim Date: Mon, 31 Oct 2022 20:46:26 +0900 Subject: 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 --- src/clock.c | 26 ++++++++++++++++++++++++++ src/ntp.c | 7 +++++++ src/timeserver.c | 7 ++++++- 3 files changed, 39 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3