Comments (11)
this may fix the problem for the moment though it probably isn't the most correct way to do it:
long sec = static_cast<long>(floor(timeoutSec));
long usec = static_cast<long>(floor( (timeoutSec - sec) *1e6));
#ifdef __APPLE__
timeval timeout;
timeout.tv_sec = sec;
timeout.tv_usec = usec;
#else
timeval timeout = { sec, usec };
#endif
Also if you make that change you should consider a very small function rather than the same code in 3 places.
from cisst.
bump, this issue is still pending
from cisst.
Would the following code work?
#if (CISST_OS == CISST_DARWIN)
time_t sec = static_cast<time_t>(floor(timeoutSec));
suseconds_t usec = static_cast<suseconds_t>((timeoutSec - sec) * 1e6);
#else
long sec = static_cast<long>(floor(timeoutSec));
long usec = static_cast<long>((timeoutSec - sec) * 1e6);
#endif
timeval timeout = { sec, usec };
I believe the first code block would apply to Linux as well; perhaps to all operating systems except Windows.
from cisst.
Unfortunately that version wouldn't work because timeval is defined slightly differently on darwin and the bracket notation didn't seem to compile if I recall correctly.
from cisst.
It could potentially be the following, though I'm not sure how the CISST_DARWIN flag would work on ios:
long sec = static_cast<long>(floor(timeoutSec));
long usec = static_cast<long>(floor( (timeoutSec - sec) *1e6));
#if (CISST_OS == CISST_DARWIN)
timeval timeout;
timeout.tv_sec = sec;
timeout.tv_usec = usec;
#else
timeval timeout = { sec, usec };
#endif
from cisst.
The way I read the compiler output, the problem is not with the bracket notation, but rather with the attempt to do an implicit typecast when using the bracket notation. Please try the code I suggested on your Mac -- I don't have one to try it out.
from cisst.
can we try to move this forward? Resolving these bugs would allow me to use cisst as a library installed on my OS rather than as a directory within my build tree.
from cisst.
Try again with the latest checkin (devel branch). Compiled successfully on Windows VS 2008, Ubuntu 12.04 (gcc 4.6.3), and QNX.
from cisst.
This does not work on OS X, partially because suseconds_t is not a defined type. Furthermore, there are two additional places where the code breaks that were missed by the patch.
The image below shows the lines and changes to the files necessary to work on OS X:
from cisst.
If not suseconds_t
and time_t
, what types does Mac OSX use? If we are going to do conditional compilation for Mac, we might as well use the correct types (I doubt it uses long
).
from cisst.
nevermind, I patched it to work. suseconds_t seems to be ok
from cisst.
Related Issues (20)
- cmnLogger issue in conditional statement HOT 3
- cmnPrintf.h no viable conversion from returned value of type 'std::ostream' on mac HOT 4
- catkin build fails HOT 2
- Markdown alignment error in SVL wiki HOT 1
- catkin build /usr/bin/ld: cannot find -lReflexxesTypeII under ROS Kinetic HOT 3
- mtsFrm4x4
- Add constructor for vctAxisAngleRotation3() using axis and angle HOT 2
- cisst build fails on feature-cxx-compatibility branch HOT 5
- on branch devel: error thrown in mtsGenericObjectProxy::ConditionalCreate HOT 1
- Should the Data Generator Always be Built? HOT 6
- Problem with disconnecting services
- cisstDataGenerator failed to parse mtsParameterTypes.cdg HOT 4
- Support C++17 ISO Standard
- Fail to build cisst with catkin build and cmake versions >= 3.11 on Ubuntu 16.04 HOT 9
- cisstVector Build Fails WhenUsing ClangCl with MSVC 2019
- catkin_make err HOT 1
- Fail to build cisst-ros with catkin build on Ubuntu 16.04 (cannot find mtsDelayedConnections.h) HOT 3
- cisstNumerical Build Fails in Latest Release HOT 6
- Build cisst_netlib error HOT 5
- ROSToCISST missing matrix functionality (std_msgs::Float64MultiArray ---> vctDoubleVec) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cisst.