-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtime_module.py
40 lines (31 loc) · 1010 Bytes
/
time_module.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from datetime import datetime
from possum_common import *
class PossumTime(dbus.service.Object):
def __init__(self, bus_name):
dbus.service.Object.__init__(self, bus_name, '/time')
@dbus.service.method('possum.time')
@log_dbus_invoke
def echo_test(self, echo_dict):
for key in echo_dict:
print "\t\t", key, echo_dict[key]
return echo_dict
@dbus.service.method('possum.time')
@log_dbus_invoke
def set_hw_time(self, timestamp):
print(timestamp)
return True
@dbus.service.method('possum.time')
@log_dbus_invoke
def set_sw_time(self, timestamp):
print(timestamp)
return True
@dbus.service.method('possum.time')
@log_dbus_invoke
def get_hw_time(self):
# TODO: get hardware time
return -1
@dbus.service.method('possum.time')
@log_dbus_invoke
def get_sw_time(self):
# TODO: get software time
return datetime.now().strftime('%Y-%m-%d %H:%M:%S')