---
 Makefile.am    |    3 ++-
 test/set-clock |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100755 test/set-clock

diff --git a/Makefile.am b/Makefile.am
index 04677ac..f05b755 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -331,7 +331,8 @@ test_scripts = test/get-state test/list-services \
                test/test-session test/test-supplicant \
                test/test-new-supplicant test/service-move-before \
                test/set-global-timeservers test/get-global-timeservers \
-               test/set-nameservers test/set-domains test/set-timeservers
+               test/set-nameservers test/set-domains test/set-timeservers \
+               test/set-clock
 
 test_scripts += test/vpn-connect test/vpn-disconnect test/vpn-get \
                test/monitor-vpn test/vpn-property
diff --git a/test/set-clock b/test/set-clock
new file mode 100755
index 0000000..a9db3e3
--- /dev/null
+++ b/test/set-clock
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+def print_usage():
+       print "Usage: %s TimeUpdates|TimezoneUpdates manual|auto" % 
(sys.argv[0])
+       sys.exit(1)
+
+
+def make_variant(string):
+       return dbus.String(string, variant_level=1)
+
+
+if (len(sys.argv) != 3):
+       print_usage()
+
+if (sys.argv[1] != "TimeUpdates" and sys.argv[1] != "TimezoneUpdates"):
+       print_usage()
+
+if (sys.argv[2] != "manual" and sys.argv[2] != "auto"):
+       print_usage()
+
+bus = dbus.SystemBus()
+
+clock = dbus.Interface(bus.get_object('net.connman', '/'),
+                                       'net.connman.Clock')
+
+print "Setting %s to %s" % (sys.argv[1], sys.argv[2])
+
+clock.SetProperty(sys.argv[1], make_variant(sys.argv[2]),
+                 signature=dbus.Signature('sv'))
-- 
1.7.10.4

_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to