From: Jaehyun Kim Date: Mon, 19 Jul 2021 07:36:36 +0000 (+0900) Subject: Added a dbus property 'TimeUpdated' X-Git-Tag: accepted/tizen/unified/20210726.135508^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a01a64f7444af4734621ba43af3f11216891e245;p=platform%2Fupstream%2Fconnman.git Added a dbus property 'TimeUpdated' A property has been added to indicate whether the time has been updated by NTP. Change-Id: I86b8a0c2df377168f98656618efd82bb7da91800 Signed-off-by: Jaehyun Kim --- diff --git a/src/clock.c b/src/clock.c index f04cf17..40729b2 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 97bb80a..e92f2b1 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 ccea3ea..0de4df7 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) {