class documentation

class Time(genpy.Time):

Constructor: Time(secs, nsecs)

View In Hierarchy

Time represents the ROS 'time' primitive type, which consists of two integers: seconds since epoch and nanoseconds since seconds. Time instances are mutable.

The L{Time.now()} factory method can initialize Time to the current ROS time and L{from_sec()} can be used to create a Time instance from the Python's time.time() float seconds representation.

The Time class allows you to subtract Time instances to compute Durations, as well as add Durations to Time to create new Time instances.

Usage::

now = rospy.Time.now() zero_time = rospy.Time()

print 'Fields are', now.secs, now.nsecs

# Time arithmetic five_secs_ago = now - rospy.Duration(5) # Time minus Duration is a Time five_seconds = now - five_secs_ago # Time minus Time is a Duration true_val = now > five_secs_ago

# NOTE: in general, you will want to avoid using time.time() in ROS code import time py_time = rospy.Time.from_sec(time.time())

Class Method from_seconds Use Time.from_sec() instead. Retained for backwards compatibility.
Static Method now Create new L{Time} instance representing current time. This can either be wall-clock time or a simulated clock. It is strongly recommended that you use the now() factory to create current time representations instead of reading wall-clock time and create Time instances from it.
Method __init__ Constructor: secs and nsecs are integers and correspond to the ROS 'time' primitive type. You may prefer to use the static L{from_sec()} and L{now()} factory methods instead.
Method __repr__ Undocumented
Class Variable __slots__ Undocumented
@classmethod
def from_seconds(cls, float_secs):

Use Time.from_sec() instead. Retained for backwards compatibility.

@param float_secs: time value in time.time() format @type float_secs: float @return: Time instance for specified time @rtype: L{Time}

@staticmethod
def now():

Create new L{Time} instance representing current time. This can either be wall-clock time or a simulated clock. It is strongly recommended that you use the now() factory to create current time representations instead of reading wall-clock time and create Time instances from it.

@return: L{Time} instance for current time @rtype: L{Time}

def __init__(self, secs=0, nsecs=0):

Constructor: secs and nsecs are integers and correspond to the ROS 'time' primitive type. You may prefer to use the static L{from_sec()} and L{now()} factory methods instead.

@param secs: seconds since epoch @type secs: int @param nsecs: nanoseconds since seconds (since epoch) @type nsecs: int

def __repr__(self):

Undocumented

__slots__: list =

Undocumented