This commit is contained in:
William Woodall 2015-12-14 00:42:23 -08:00
parent 43c1824909
commit 5c07b9eec3
2 changed files with 3 additions and 2 deletions

View file

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include <stdlib.h>
#include <atomic> #include <atomic>
#if defined(__APPLE__) #if defined(__APPLE__)

View file

@ -103,7 +103,7 @@ TEST_F(TestTimeFixture, test_rcl_steady_time_point_now) {
rcl_steady_time_point_t later; rcl_steady_time_point_t later;
ret = rcl_steady_time_point_now(&later); ret = rcl_steady_time_point_now(&later);
std::chrono::steady_clock::time_point later_sc = std::chrono::steady_clock::now(); std::chrono::steady_clock::time_point later_sc = std::chrono::steady_clock::now();
uint64_t steady_diff = later.nanoseconds - now.nanoseconds; int64_t steady_diff = later.nanoseconds - now.nanoseconds;
uint64_t sc_diff = (now_sc - later_sc).count(); int64_t sc_diff = (now_sc - later_sc).count();
EXPECT_LE(llabs(steady_diff - sc_diff), RCL_MS_TO_NS(1000)) << "steady_clock differs"; EXPECT_LE(llabs(steady_diff - sc_diff), RCL_MS_TO_NS(1000)) << "steady_clock differs";
} }