Skip to content

Commit a6df8d0

Browse files
change to Duration class, allow float in sec variable
1 parent aa510f5 commit a6df8d0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/compas_fab/robots/time_.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ class Duration(object):
1919
"""
2020

2121
def __init__(self, secs, nsecs):
22-
self.secs = int(secs)
23-
self.nsecs = int(nsecs)
22+
sec_to_nano_factor = 1e9
23+
quotient, remainder = divmod(secs, 1)
24+
25+
self.secs = int(quotient)
26+
self.nsecs = int(remainder*sec_to_nano_factor) + int(nsecs)
2427

2528
def __str__(self):
2629
return 'Duration({!r}, {!r})'.format(self.secs, self.nsecs)

0 commit comments

Comments
 (0)