Skip to content

Commit aa7fd83

Browse files
authored
fix: resolve MSVC build errors and warnings (#91)
1 parent d962958 commit aa7fd83

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

behaviortree_ros2/src/tree_execution_server.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@
1111
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1212
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1313

14+
#ifdef _MSC_VER
15+
#pragma warning(push)
16+
#pragma warning(disable : 4244)
1417
#include <thread>
18+
#pragma warning(pop)
19+
#else
20+
#include <thread>
21+
#endif
1522

1623
#include "behaviortree_ros2/tree_execution_server.hpp"
1724
#include "behaviortree_ros2/bt_utils.hpp"
@@ -235,7 +242,8 @@ void TreeExecutionServer::execute(
235242
const auto now = std::chrono::steady_clock::now();
236243
if(now < loop_deadline)
237244
{
238-
p_->tree.sleep(loop_deadline - now);
245+
p_->tree.sleep(std::chrono::duration_cast<std::chrono::system_clock::duration>(
246+
loop_deadline - now));
239247
}
240248
loop_deadline += period;
241249
}

0 commit comments

Comments
 (0)