diff options
author | Jaehyun Kim <jeik01.kim@samsung.com> | 2021-07-19 16:36:36 +0900 |
---|---|---|
committer | Jaehyun Kim <jeik01.kim@samsung.com> | 2021-07-19 16:41:49 +0900 |
commit | a01a64f7444af4734621ba43af3f11216891e245 (patch) | |
tree | d134a5f814c808b78fd5f357891fe1864f71d879 | |
parent | fac1c8b4bd3f6853d8548ad40902fdf25b345f94 (diff) | |
download | connman-a01a64f7444af4734621ba43af3f11216891e245.tar.gz connman-a01a64f7444af4734621ba43af3f11216891e245.tar.bz2 connman-a01a64f7444af4734621ba43af3f11216891e245.zip |
Added a dbus property 'TimeUpdated'submit/tizen/20210723.060030accepted/tizen/unified/20210726.135508
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-x | src/clock.c | 19 | ||||
-rwxr-xr-x | src/connman.h | 3 | ||||
-rwxr-xr-x | src/ntp.c | 2 |
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); @@ -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) { |