Skip to content
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

Add ROSTIME_DECL storage-class attribute #90

Merged
merged 2 commits into from
Aug 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rostime/include/ros/duration.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ class ROSTIME_DECL WallDuration : public DurationBase<WallDuration>
bool sleep() const;
};

std::ostream &operator <<(std::ostream &os, const Duration &rhs);
std::ostream &operator <<(std::ostream &os, const WallDuration &rhs);
ROSTIME_DECL std::ostream &operator <<(std::ostream &os, const Duration &rhs);
ROSTIME_DECL std::ostream &operator <<(std::ostream &os, const WallDuration &rhs);


}
Expand Down
9 changes: 9 additions & 0 deletions rostime/test/time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
#include <gtest/gtest.h>
#include <ros/rate.h>
#include <ros/time.h>
#ifndef _WIN32
#include <sys/time.h>
#endif

#include <boost/date_time/posix_time/ptime.hpp>

Expand All @@ -45,9 +47,13 @@ double epsilon = 1e-9;
void seed_rand()
{
//Seed random number generator with current microseond count
#ifndef _WIN32
timeval temp_time_struct;
gettimeofday(&temp_time_struct,NULL);
srand(temp_time_struct.tv_usec);
#else
srand(time(nullptr));
#endif
};

void generate_rand_times(uint32_t range, uint64_t runs, std::vector<ros::Time>& values1, std::vector<ros::Time>& values2)
Expand Down Expand Up @@ -509,8 +515,11 @@ void alarmHandler(int sig)

TEST(Duration, sleepWithSignal)
{
#ifndef _WIN32
signal(SIGALRM, alarmHandler);
alarm(1);
#endif

Time start = Time::now();
Duration d(2.0);
bool rc = d.sleep();
Expand Down