Added data_age () to compute data's age
This commit is contained in:
parent
43a526b001
commit
0bc6fe907a
10
vcub.py
10
vcub.py
|
@ -36,7 +36,7 @@ class Vcub ():
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
def __init__ (self, autoupdate_at_creation = True, autoupdate = False, autoupdate_delay = -1):
|
def __init__ (self, autoupdate_at_creation = True, autoupdate = False, autoupdate_delay = -1):
|
||||||
self.lastupdate = 0
|
self.last_update = 0
|
||||||
self.data = None
|
self.data = None
|
||||||
if autoupdate_at_creation:
|
if autoupdate_at_creation:
|
||||||
self.update ()
|
self.update ()
|
||||||
|
@ -63,7 +63,13 @@ class Vcub ():
|
||||||
'location': (float (l [0]), float (l [1]))
|
'location': (float (l [0]), float (l [1]))
|
||||||
}
|
}
|
||||||
self.data [int (j ['bm:IDENT'])] = e
|
self.data [int (j ['bm:IDENT'])] = e
|
||||||
self.lastupdate = time ()
|
self.last_update = time ()
|
||||||
|
|
||||||
|
def data_age (self):
|
||||||
|
'''
|
||||||
|
Computes the data's age
|
||||||
|
'''
|
||||||
|
return (time () - self.last_update)
|
||||||
|
|
||||||
def get_names (self):
|
def get_names (self):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in New Issue