-
Notifications
You must be signed in to change notification settings - Fork 72
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
Time#get secondsAndNanoseconds bug #531
Comments
I'm not exactly clear on how Timer _nanoseconds is getting goofed up. In my branch I created a new int64 from _nanoseconds as shown below and this works for me. get secondsAndNanoseconds() {
const nanos = int64.from(this._nanoseconds);
const seconds = nanos.divide(1e9).toNumber();
const nanoseconds = nanos.mod(1e9).toNumber();
return {seconds, nanoseconds};
} Thoughts? I can submit a PR with this modification. |
Oops, there should be using a temporary var to store the result as the value will be changed after calling the function ( As JavaScript cannot represent 64 bits integers, we leverage get secondsAndNanoseconds() {
const seconds = int64.from(this._nanoseconds).divide(1e9).toNumber();
const nanoseconds = int64.from(this._nanoseconds).mod(1e9).toNumber();
return {seconds, nanoseconds};
} |
Checking in to see if there are actions I need to take to get the fix committed? I have observed the work with CI config to get builds working correctly. |
I have resolve the problem on macOS/Linux platforms, see #536. But on Windows10, I meet the error of importing P.S. instruction about the error of importing Python module: https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system |
re: your Q about my experience on Windows, can't say as I don't have a windows system atm. |
Hi @wayneparrott, finally I get all CIs to be green 😄 , please check the latest SHA d2724ff. So would you please rebase your PR (#533) on the |
Hi @wayneparrott, I have rebased your patch and landed it on the |
I've isolated an issue in Time where _nanoseconds is being modified when calling the getter 'secondsAndNanoseconds' in version 0.10.2 on MacOS Catalina.
This example program prints out the _nanoseconds before and after calling secondsAndNanoseconds. I can see _nanoseconds change after calling secondsAndNanoseconds. If I comment out the call to secondsAndNanoseconds, _nanoseconds remains unchanged. Notice in the example output how time2 values of _nanosecond are a subset of the original time1 value.
example output
time1 1572996022175992874
time2 572996022
time1 1572996022925996911
time2 572996022
time1 1572996023677128755
time2 572996023
time1 1572996024427889376
time2 572996024
time1 1572996025178983458
time2 572996025
time1 1572996025932756150
time2 572996025
The text was updated successfully, but these errors were encountered: