Ask Your Question
0

Converting ros::Time to plain data structure

asked 2019-01-24 09:45:48 -0600

debonair gravatar image

updated 2019-01-24 10:10:18 -0600

ros::time is derived from Time and Time class has 2 members uint32 sec, nsec. If I have ros::time, how do I store it into plain structure where i just have 2 uint32 fields. ros::time has toSec() and toNSec(), but neither of which returns uint32. How do I convert ros::time to

Message time {
  uint32 sec, nsec;
}
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-01-24 10:10:50 -0600

VictorLamoine gravatar image

sec and nsec are public members of the ros::Time class:

  struct Time {
    uint32_t sec;
    uint32_t nsec;
  };

  Time t2;
  ros::Time t1;
  t2.sec = t1.sec;
  t2.nsec = t1.nsec;
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2019-01-24 09:45:48 -0600

Seen: 193 times

Last updated: Jan 24 '19