summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2021-07-19 16:36:36 +0900
committerJaehyun Kim <jeik01.kim@samsung.com>2021-07-19 16:41:49 +0900
commita01a64f7444af4734621ba43af3f11216891e245 (patch)
treed134a5f814c808b78fd5f357891fe1864f71d879
parentfac1c8b4bd3f6853d8548ad40902fdf25b345f94 (diff)
downloadconnman-accepted/tizen/unified/20210726.135508.tar.gz
connman-accepted/tizen/unified/20210726.135508.tar.bz2
connman-accepted/tizen/unified/20210726.135508.zip
A property has been added to indicate whether the time has been updated by NTP. Change-Id: I86b8a0c2df377168f98656618efd82bb7da91800 Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
-rwxr-xr-xsrc/clock.c19
-rwxr-xr-xsrc/connman.h3
-rwxr-xr-xsrc/ntp.c2
3 files changed, 24 insertions, 0 deletions
diff --git a/src/clock.c b/src/clock.c
index f04cf175..40729b2e 100755
--- a/src/clock.c
+++ b/src/clock.c
@@ -39,6 +39,9 @@ static enum time_updates time_updates_config = TIME_UPDATES_AUTO;
static enum timezone_updates timezone_updates_config = TIMEZONE_UPDATES_AUTO;
static char *timezone_config = NULL;
+#if defined TIZEN_EXT
+static bool time_updated = false;
+#endif
static const char *time_updates2string(enum time_updates value)
{
@@ -175,6 +178,9 @@ static DBusMessage *get_properties(DBusConnection *conn,
DBusMessageIter array, dict;
struct timeval tv;
const char *str;
+#if defined TIZEN_EXT
+ dbus_bool_t val = time_updated;
+#endif
DBG("conn %p", conn);
@@ -186,6 +192,12 @@ static DBusMessage *get_properties(DBusConnection *conn,
connman_dbus_dict_open(&array, &dict);
+#if defined TIZEN_EXT
+ connman_dbus_dict_append_basic(&dict, "TimeUpdated",
+ DBUS_TYPE_BOOLEAN,
+ &val);
+#endif
+
if (gettimeofday(&tv, NULL) == 0) {
dbus_uint64_t val = tv.tv_sec;
@@ -392,6 +404,13 @@ static const GDBusSignalTable clock_signals[] = {
static DBusConnection *connection = NULL;
+#if defined TIZEN_EXT
+void __connman_clock_set_time_updated(bool updated)
+{
+ time_updated = updated;
+}
+#endif
+
void __connman_clock_update_timezone(void)
{
DBG("");
diff --git a/src/connman.h b/src/connman.h
index 97bb80a5..e92f2b1a 100755
--- a/src/connman.h
+++ b/src/connman.h
@@ -79,6 +79,9 @@ int __connman_clock_init(void);
void __connman_clock_cleanup(void);
void __connman_clock_update_timezone(void);
+#if defined TIZEN_EXT
+void __connman_clock_set_time_updated(bool updated);
+#endif
int __connman_timezone_init(void);
void __connman_timezone_cleanup(void);
diff --git a/src/ntp.c b/src/ntp.c
index ccea3ea5..0de4df75 100755
--- a/src/ntp.c
+++ b/src/ntp.c
@@ -407,6 +407,8 @@ static void decode_msg(struct ntp_data *nd, void *base, size_t len,
DBG("%lu cur seconds, %lu cur nsecs, %lu req seconds, %lu req nsecs",
cur.tv_sec, cur.tv_nsec, req.tv_sec, req.tv_nsec);
DBG("setting time");
+
+ __connman_clock_set_time_updated(true);
}
#else
if (offset < STEPTIME_MIN_OFFSET && offset > -STEPTIME_MIN_OFFSET) {