From 74e3b8073aa6cfcf74eb199f2cae9d0251614e43 Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Tue, 6 Feb 2024 14:44:47 +1100 Subject: [PATCH] Create ros-humble-rostime.win.patch --- patch/ros-humble-rostime.win.patch | 179 +++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 patch/ros-humble-rostime.win.patch diff --git a/patch/ros-humble-rostime.win.patch b/patch/ros-humble-rostime.win.patch new file mode 100644 index 00000000..7fa36441 --- /dev/null +++ b/patch/ros-humble-rostime.win.patch @@ -0,0 +1,179 @@ +diff --git a/rostime/include/ros/duration.h b/rostime/include/ros/duration.h +index edd82dd..6a0e883 100644 +--- a/rostime/include/ros/duration.h ++++ b/rostime/include/ros/duration.h +@@ -95,6 +95,7 @@ class DurationBase + T& fromNSec(int64_t t); + bool isZero() const; + boost::posix_time::time_duration toBoost() const; ++#ifndef _MSC_VER + static const T MIN; //!< Minimum representable duration (negative) + static const T MAX; //!< Maximum representable duration + static const T ZERO; //!< Zero duration +@@ -105,6 +106,7 @@ class DurationBase + static const T MILLISECOND; //!< One millisecond duration + static const T MICROSECOND; //!< One microsecond duration + static const T NANOSECOND; //!< One nanosecond duration ++#endif + }; + + class Rate; +@@ -136,6 +138,7 @@ class ROSTIME_DECL Duration : public DurationBase + + extern ROSTIME_DECL const Duration DURATION_MAX; + extern ROSTIME_DECL const Duration DURATION_MIN; ++#ifndef _MSC_VER + template<> const Duration DurationBase::MAX; + template<> const Duration DurationBase::MIN; + template<> const Duration DurationBase::ZERO; +@@ -146,6 +149,7 @@ template<> const Duration DurationBase::SECOND; + template<> const Duration DurationBase::MILLISECOND; + template<> const Duration DurationBase::MICROSECOND; + template<> const Duration DurationBase::NANOSECOND; ++#endif + + /** + * \brief Duration representation for use with the WallTime class. +@@ -172,6 +176,7 @@ class ROSTIME_DECL WallDuration : public DurationBase + bool sleep() const; + }; + ++#ifndef _MSC_VER + template<> const WallDuration DurationBase::MAX; + template<> const WallDuration DurationBase::MIN; + template<> const WallDuration DurationBase::ZERO; +@@ -182,6 +187,7 @@ template<> const WallDuration DurationBase::SECOND; + template<> const WallDuration DurationBase::MILLISECOND; + template<> const WallDuration DurationBase::MICROSECOND; + template<> const WallDuration DurationBase::NANOSECOND; ++#endif + + ROSTIME_DECL std::ostream &operator <<(std::ostream &os, const Duration &rhs); + ROSTIME_DECL std::ostream &operator <<(std::ostream &os, const WallDuration &rhs); +diff --git a/rostime/include/ros/time.h b/rostime/include/ros/time.h +index c4ff2fe..79f2eae 100644 +--- a/rostime/include/ros/time.h ++++ b/rostime/include/ros/time.h +@@ -160,10 +160,12 @@ namespace ros + inline bool is_zero() const { return isZero(); } + boost::posix_time::ptime toBoost() const; + ++#ifndef _MSC_VER + static const T MIN; //!< Minimum representable time + static const T MAX; //!< Maximum representable time + static const T ZERO; //!< Zero (invalid) time + static const T UNINITIALIZED; //!< Uninitialized time ++#endif + }; + + /** +@@ -221,10 +223,12 @@ namespace ros + + extern ROSTIME_DECL const Time TIME_MAX; + extern ROSTIME_DECL const Time TIME_MIN; ++#ifndef _MSC_VER + template<> const Time TimeBase::MAX; + template<> const Time TimeBase::MIN; + template<> const Time TimeBase::ZERO; + template<> const Time TimeBase::UNINITIALIZED; ++#endif + + /** + * \brief Time representation. Always wall-clock time. +@@ -258,11 +262,13 @@ namespace ros + static bool isSystemTime() { return true; } + }; + ++#ifndef _MSC_VER + template<> const WallTime TimeBase::MAX; + template<> const WallTime TimeBase::MIN; + template<> const WallTime TimeBase::ZERO; + template<> const WallTime TimeBase::UNINITIALIZED; +- ++#endif ++ + /** + * \brief Time representation. Always steady-clock time. + * +@@ -297,10 +303,12 @@ namespace ros + static bool isSystemTime() { return true; } + }; + ++#ifndef _MSC_VER + template<> const SteadyTime TimeBase::MAX; + template<> const SteadyTime TimeBase::MIN; + template<> const SteadyTime TimeBase::ZERO; + template<> const SteadyTime TimeBase::UNINITIALIZED; ++#endif + + ROSTIME_DECL std::ostream &operator <<(std::ostream &os, const Time &rhs); + ROSTIME_DECL std::ostream &operator <<(std::ostream &os, const WallTime &rhs); +diff --git a/rostime/src/time.cpp b/rostime/src/time.cpp +index 7edb3cc..0bca1c4 100644 +--- a/rostime/src/time.cpp ++++ b/rostime/src/time.cpp +@@ -83,6 +83,7 @@ namespace ros + const Duration DURATION_MAX(std::numeric_limits::max(), 999999999); + const Duration DURATION_MIN(std::numeric_limits::min(), 0); + ++#ifndef _MSC_VER + template<> const Duration DurationBase::MAX = DURATION_MAX; + template<> const Duration DurationBase::MIN = DURATION_MIN; + template<> const Duration DurationBase::ZERO = Duration(0, 0); +@@ -104,10 +105,12 @@ namespace ros + template<> const WallDuration DurationBase::MILLISECOND = WallDuration(Duration::MILLISECOND.sec, Duration::MILLISECOND.nsec); + template<> const WallDuration DurationBase::MICROSECOND = WallDuration(Duration::MICROSECOND.sec, Duration::MICROSECOND.nsec); + template<> const WallDuration DurationBase::NANOSECOND = WallDuration(Duration::NANOSECOND.sec, Duration::NANOSECOND.nsec); ++#endif + + const Time TIME_MAX(std::numeric_limits::max(), 999999999); + const Time TIME_MIN(0, 1); + ++#ifndef _MSC_VER + template<> const Time TimeBase::MAX = TIME_MAX; + template<> const Time TimeBase::MIN = TIME_MIN; + template<> const Time TimeBase::ZERO = Time(0, 0); +@@ -122,6 +125,7 @@ namespace ros + template<> const SteadyTime TimeBase::MIN = SteadyTime(Time::MIN.sec, Time::MIN.nsec); + template<> const SteadyTime TimeBase::ZERO = SteadyTime(Time::ZERO.sec, Time::ZERO.nsec); + template<> const SteadyTime TimeBase::UNINITIALIZED = SteadyTime(Time::UNINITIALIZED.sec, Time::UNINITIALIZED.nsec); ++#endif + + // This is declared here because it's set from the Time class but read from + // the Duration class, and need not be exported to users of either. +diff --git a/rostime/test/time.cpp b/rostime/test/time.cpp +index 96ef161..e52a960 100644 +--- a/rostime/test/time.cpp ++++ b/rostime/test/time.cpp +@@ -370,6 +370,7 @@ TEST(Time, OperatorPlusExceptions) + EXPECT_THROW(t5 + d3, std::runtime_error); + } + ++#ifndef _MSC_VER + TEST(Time, Constants) + { + EXPECT_EQ(Time::MAX.sec, static_cast(-1)); +@@ -399,6 +400,7 @@ TEST(Time, Constants) + EXPECT_EQ(SteadyTime::UNINITIALIZED.sec, 0); + EXPECT_EQ(SteadyTime::UNINITIALIZED.nsec, 0); + } ++#endif + + /************************************* Duration Tests *****************/ + +@@ -588,6 +590,7 @@ TEST(Duration, sleepWithSignal) + ASSERT_TRUE(rc); + } + ++#ifndef _MSC_VER + TEST(Duration, Constants) + { + EXPECT_EQ(Duration::MAX.sec, std::numeric_limits::max()); +@@ -632,6 +635,7 @@ TEST(Duration, Constants) + EXPECT_EQ(WallDuration::DAY.sec, 60 * 60 * 24); + EXPECT_EQ(WallDuration::DAY.nsec, 0); + } ++#endif + + TEST(Rate, constructFromDuration){ + Duration d(4, 0);