Revision 04cf2b6f client/python/hlrc_client/RobotTimestamp.py
client/python/hlrc_client/RobotTimestamp.py | ||
---|---|---|
25 | 25 |
Excellence Initiative. |
26 | 26 |
""" |
27 | 27 |
import time |
28 |
import sys |
|
28 | 29 |
|
29 | 30 |
class RobotTimestamp: |
30 | 31 |
def __init__(self): |
... | ... | |
32 | 33 |
self.secs = int(seconds) |
33 | 34 |
self.nsecs = int((seconds - self.secs) * 1000000000) |
34 | 35 |
|
36 |
|
|
35 | 37 |
@classmethod |
36 | 38 |
def from_sec_nsec(cls, _sec, _nsec): |
37 | 39 |
cls.sec = _sec |
38 | 40 |
cls.nsec = _nsec |
39 | 41 |
|
42 |
@classmethod |
|
43 |
def from_system_time(cls): |
|
44 |
seconds = time.time() |
|
45 |
cls.secs = int(seconds) |
|
46 |
cls.nsecs = int((seconds - self.secs) * 1000000000) |
|
47 |
|
|
40 | 48 |
def to_seconds(self): |
41 |
return self.secs + ((float(self.nsec)) / 1000000000) |
|
49 |
return self.secs + ((float(self.nsecs)) / 1000000000)
|
|
42 | 50 |
|
43 | 51 |
def __str__(self): |
44 | 52 |
return "%f" % self.to_seconds() |
Also available in: Unified diff