seconds

Returns seconds of a time or duration

Description

example

secs = seconds(time) returns the scalar number, secs, in seconds that represents the same value as the time object, time.

secs = seconds(duration) returns the scalar number, secs, in seconds that represents the same value as the duration object, duration.

Examples

collapse all

Use the seconds function to get the total seconds of a Time object from its Secs and Nsecs properties.

Create a Time object.

time = rostime(1,860000000)
time = 
  ROS Time with properties:

     Sec: 1
    Nsec: 860000000

Get the total seconds from the time object.

secs = seconds(time)
secs = 1.8600

Input Arguments

collapse all

ROS or system time, specified as a Time object handle. Create a Time object using rostime.

Duration, specified as a ROS Duration object with Sec and Nsec properties. Create a Duration object using rosduration.

Output Arguments

collapse all

Total time of the Time or Duration object, returned as a scalar in seconds.

Introduced in R2019b