Class: ROS::Time
Overview
ROS Time object. This is used as msg object for time
Instance Attribute Summary
Attributes inherited from TimeValue
Class Method Summary collapse
-
.now ⇒ Object
initialize with current time.
Instance Method Summary collapse
-
#+(duration) ⇒ Time
add time value.
-
#-(other) ⇒ Duration
subtract time value.
-
#initialize(time = nil) ⇒ Time
constructor
A new instance of Time.
Methods inherited from TimeValue
#<=>, #canonicalize, #to_nsec, #to_sec
Constructor Details
Class Method Details
.now ⇒ Object
initialize with current time
71 72 73 |
# File 'lib/ros/time.rb', line 71 def self.now self.new(::Time::now) end |
Instance Method Details
#+(duration) ⇒ Time
add time value
92 93 94 95 96 97 |
# File 'lib/ros/time.rb', line 92 def +(duration) tm = ::ROS::Time.new tm.secs = @secs + duration.secs tm.nsecs = @nsecs + duration.nsecs tm.canonicalize end |
#-(other) ⇒ Duration
subtract time value
102 103 104 105 106 107 |
# File 'lib/ros/time.rb', line 102 def -(other) d = ::ROS::Duration.new d.secs = @secs - other.secs d.nsecs = @nsecs - other.nsecs d.canonicalize end |