/* * __connman_timeserver_get_all function creates the timeserver * list which will be used to determine NTP server for time corrections. * The service settings take priority over the global timeservers. */ GSList *__connman_timeserver_get_all(struct connman_service *service) { GSList *list = NULL; struct connman_network *network; char **timeservers; char **service_ts; char **service_ts_config; const char *service_gw; char **fallback_ts; int index, i; if (__connman_clock_timeupdates() == TIME_UPDATES_MANUAL) return NULL; service_ts_config = connman_service_get_timeservers_config(service); /* First add Service Timeservers.Configuration to the list */ for (i = 0; service_ts_config && service_ts_config[i]; 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 && service_ts[i]; i++) list = __connman_timeserver_add_list(list, service_ts[i]); network = __connman_service_get_network(service); if (network) { 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) list = __connman_timeserver_add_list(list, service_gw); } /* Then add Global Timeservers to the list */ timeservers = load_timeservers(); for (i = 0; timeservers && timeservers[i]; 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 && fallback_ts[i]; i++) list = __connman_timeserver_add_list(list, fallback_ts[i]); return g_slist_reverse(list); }
static void update_timeservers(void) { set_entry(builder, "timerservers", connman_service_get_timeservers(path), ""); set_entry(builder, "timerservers_conf", connman_service_get_timeservers_config(path), ""); }