service: Add function to set timeservers
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Fri, 22 Feb 2013 11:47:52 +0000 (13:47 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 22 Feb 2013 12:43:14 +0000 (14:43 +0200)
src/connman.h
src/service.c

index 2001875..8c16798 100644 (file)
@@ -655,6 +655,8 @@ void __connman_service_nameserver_add_routes(struct connman_service *service,
                                                const char *gw);
 void __connman_service_nameserver_del_routes(struct connman_service *service,
                                        enum connman_ipconfig_type type);
+void __connman_service_set_timeservers(struct connman_service *service,
+                                               char **timeservers);
 int __connman_service_timeserver_append(struct connman_service *service,
                                                const char *timeserver);
 int __connman_service_timeserver_remove(struct connman_service *service,
index 236879e..36cc3c8 100644 (file)
@@ -2521,6 +2521,21 @@ const char *connman_service_get_proxy_autoconfig(struct connman_service *service
        return NULL;
 }
 
+void __connman_service_set_timeservers(struct connman_service *service,
+                               char **timeservers)
+{
+       int i;
+
+       if (service == NULL)
+               return;
+
+       g_strfreev(service->timeservers);
+       service->timeservers = NULL;
+
+       for (i = 0; timeservers != NULL && timeservers[i] != NULL; i++)
+               __connman_service_timeserver_append(service, timeservers[i]);
+}
+
 int __connman_service_timeserver_append(struct connman_service *service,
                                                const char *timeserver)
 {