Add an API for getting time update state.
[platform/core/api/connection.git] / src / connection.c
index 08c5a26..0048efb 100755 (executable)
@@ -1834,3 +1834,29 @@ EXPORT_API int connection_profile_save_ethernet_eap_config(connection_h connecti
        CONN_UNLOCK;
        return CONNECTION_ERROR_NONE;
 }
+
+EXPORT_API int connection_clock_is_updated(connection_h connection, bool *updated)
+{
+       CONN_LOCK;
+
+       CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+       if (!(_connection_check_handle_validity(connection))) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER;//LCOV_EXCL_LINE
+       }
+
+       int rv = _connection_libnet_get_clock_updated(connection, updated);
+
+       if (rv != CONNECTION_ERROR_NONE) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Fail to get clock update information[%d]", rv); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return rv; //LCOV_EXCL_LINE
+       }
+
+       CONNECTION_LOG(CONNECTION_INFO, "Clock updated: %s", updated ? "true" : "false");
+       CONN_UNLOCK;
+
+       return CONNECTION_ERROR_NONE;
+}