rospy: #3667 bug fix for truediv in Duration instance
This commit is contained in:
parent
de2d4cb17f
commit
960d21deda
|
@ -426,7 +426,8 @@ class Duration(TVal):
|
|||
@return: Duration multiplied by val
|
||||
@rtype: L{Duration}
|
||||
"""
|
||||
# unlike __floordiv__, this uses true div for float arg
|
||||
# unlike __floordiv__, this uses true div for float arg.
|
||||
# PEP 238
|
||||
t = type(val)
|
||||
if t in (int, long):
|
||||
return Duration(self.secs // val, self.nsecs // val)
|
||||
|
@ -443,10 +444,7 @@ class Duration(TVal):
|
|||
@return: Duration multiplied by val
|
||||
@rtype: L{Duration}
|
||||
"""
|
||||
t = type(val)
|
||||
if t in (int, long):
|
||||
return Duration(self.secs / val, self.nsecs / val)
|
||||
elif t == float:
|
||||
if type(val) in (int, long, float):
|
||||
return Duration.from_sec(self.to_sec() / val)
|
||||
else:
|
||||
return NotImplemented
|
||||
|
|
Loading…
Reference in New Issue