Revision 82f22e4a
client/python/hlrc_client/RobotTimestamp.py | ||
---|---|---|
30 | 30 |
class RobotTimestamp: |
31 | 31 |
def __init__(self): |
32 | 32 |
seconds = time.time() |
33 |
self.secs = int(seconds) |
|
34 |
self.nsecs = int((seconds - self.secs) * 1000000000) |
|
33 |
self.init_from_sec(seconds) |
|
35 | 34 |
|
35 |
@classmethod |
|
36 |
def from_sec(cls, _float_sec): |
|
37 |
cls.set_to_floatsec(_float_sec) |
|
36 | 38 |
|
37 | 39 |
@classmethod |
38 | 40 |
def from_sec_nsec(cls, _sec, _nsec): |
... | ... | |
42 | 44 |
@classmethod |
43 | 45 |
def from_system_time(cls): |
44 | 46 |
seconds = time.time() |
45 |
cls.secs = int(seconds) |
|
46 |
cls.nsecs = int((seconds - self.secs) * 1000000000) |
|
47 |
cls.init_from_sec(seconds) |
|
48 |
|
|
49 |
def init_from_sec(self, seconds): |
|
50 |
self.secs = int(seconds) |
|
51 |
self.nsecs = int((seconds - self.secs) * 1000000000) |
|
47 | 52 |
|
48 | 53 |
def to_seconds(self): |
49 | 54 |
return self.secs + ((float(self.nsecs)) / 1000000000) |
Also available in: Unified diff