+ service_ts_config = connman_service_get_timeservers_config(service);
+
+ /* First add Service Timeservers.Configuration to the list */
+ for (i = 0; service_ts_config != NULL && service_ts_config[i] != NULL;
+ i++)
+ list = __connman_timeserver_add_list(list,
+ service_ts_config[i]);
+
+ service_ts = connman_service_get_timeservers(service);
+
+ /* First add Service Timeservers via DHCP to the list */
+ for (i = 0; service_ts != NULL && service_ts[i] != NULL; i++)
+ list = __connman_timeserver_add_list(list, service_ts[i]);
+
+ network = __connman_service_get_network(service);
+ if (network != NULL) {
+ index = connman_network_get_index(network);
+ service_gw = __connman_ipconfig_get_gateway_from_index(index,
+ CONNMAN_IPCONFIG_TYPE_ALL);
+
+ /* Then add Service Gateway to the list */
+ if (service_gw != NULL)
+ list = __connman_timeserver_add_list(list, service_gw);
+ }
+
+ /* Then add Global Timeservers to the list */
+ timeservers = load_timeservers();
+
+ for (i = 0; timeservers != NULL && timeservers[i] != NULL; i++)
+ list = __connman_timeserver_add_list(list, timeservers[i]);
+
+ g_strfreev(timeservers);
+
+ fallback_ts = connman_setting_get_string_list("FallbackTimeservers");
+
+ /* Lastly add the fallback servers */
+ for (i = 0; fallback_ts != NULL && fallback_ts[i] != NULL; i++)
+ list = __connman_timeserver_add_list(list, fallback_ts[i]);
+
+ return g_slist_reverse(list);
+}
+
+/*
+ * This function must be called everytime the default service changes, the
+ * service timeserver(s) or gatway changes or the global timeserver(s) changes.
+ */
+int __connman_timeserver_sync(struct connman_service *default_service)
+{
+ struct connman_service *service;
+