-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
timespec_to_long may return incorrect value in 32bit OS #94
Comments
From what I can tell, struct timespec looks like the following:
It looks like time_t is defined to be a However, https://www.gnu.org/software/libc/manual/html_node/Time-Types.html says that this always represents a duration since a fixed point of time in the past. Further, it says that nanoseconds is always between 0 and 1,000,000. All of that implies that this can only ever be a positive number. Thus, my suggestion is that we both rename the method and make it do the right thing on 32-bit platforms. Here would be my suggestion:
And then fix all of the callers so that it uses the right name. While we are at it, we should also probably rename and fix
@y-okumura-isp What do you think? Also, can you propose a patch implementing this? Thanks. |
@clalancette Thank you for reply.
Exactly!
I will be happy to do. |
Sounds good, thank you. |
@y-okumura-isp are you still planning to push this? |
@hidmic Yes, but sorry for late work. |
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
I'm wring a patch, but I have a few questions. Here are my questions. (1) Influence on pedulum_control
As these functions will be renamed, pendulum_control will not be built (so, colcon build for ros2 will also fail). cd src/ros2
for i in *; do cd $i; echo "=== $i ==="; git grep "timespec_to_long" ;cd ..; done
for i in *; do cd $i; echo "=== $i ==="; git grep "long_to_timespec" ;cd ..; done (2) Failure for colcon testI run (2.1) cpplint for rtutils.hThis warning is for
(2.2) uncrustifyI got following error.
Regards. |
Yes, just send another PR to pendulum_control as well, and link it back to the one you open against this repository.
You can use
Both are possible; there is a CMake directive to force uncrustify to treat all files as C++. But since our style is to have all C++ header files end in Thanks for working on this! |
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
Signed-off-by: y-okumura <y-okumura@isp.co.jp>
Signed-off-by: y-okumura <y-okumura@isp.co.jp>
I think we fixed this in #96, so I'm going to go ahead and close this out. Feel free to reopen if there is further work to do here. |
Bug report
Required Info:
Steps to reproduce issue
timespec_to_long
returns incorrect value in Raspbian OS.timespec_to_long
in my code, this issue occured.Here is an example code with my suggestions.
For simplicity,
timespec_to_long
is copied from utils.h.g++ above_code.cpp
and./a.out
.Expected behavior
Result in Ubuntu 18.04 x86_64:
Actual behavior
Result in Raspbian OS:
The text was updated successfully, but these errors were encountered: