summaryrefslogtreecommitdiff
path: root/test/set-timezone
blob: 4808bd8705b6ed691a8023c008a96ab6afd566d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/python

import sys
import dbus

if (len(sys.argv) != 2):
	print("Usage: %s <timezone>" % (sys.argv[0]))
	sys.exit(1)

bus = dbus.SystemBus()

clock = dbus.Interface(bus.get_object('net.connman', '/'),
					'net.connman.Clock')

print("Setting timezone to %s" % (sys.argv[1]))

try:
	clock.SetProperty("Timezone", dbus.String(sys.argv[1], variant_level=1),
			  signature=dbus.Signature('sv'))
except dbus.exceptions.DBusException as e_msg:
	print(e_msg)