Skip to content

Commit

Permalink
Revert "cast time at macro expansion (ros2#86)" (ros2#87)
Browse files Browse the repository at this point in the history
This reverts commit 5fe6c52.
  • Loading branch information
mikaelarguedas authored Nov 4, 2016
1 parent 5fe6c52 commit 545cb56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions rcl/include/rcl/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ extern "C"
#include "rcl/types.h"
#include "rcl/visibility_control.h"

#define RCL_S_TO_NS(seconds) ((int64_t)seconds * (1000 * 1000 * 1000))
#define RCL_MS_TO_NS(milliseconds) ((int64_t)milliseconds * (1000 * 1000))
#define RCL_US_TO_NS(microseconds) ((int64_t)microseconds * 1000)
#define RCL_S_TO_NS(seconds) (seconds * (1000 * 1000 * 1000))
#define RCL_MS_TO_NS(milliseconds) (milliseconds * (1000 * 1000))
#define RCL_US_TO_NS(microseconds) (microseconds * 1000)

#define RCL_NS_TO_S(nanoseconds) (nanoseconds / (1000 * 1000 * 1000))
#define RCL_NS_TO_MS(nanoseconds) (nanoseconds / (1000 * 1000))
Expand Down
4 changes: 2 additions & 2 deletions rcl/src/rcl/time_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ rcl_system_time_now(rcl_time_point_value_t * now)
RCL_SET_ERROR_MSG("unexpected negative time");
return RCL_RET_ERROR;
}
*now = RCL_S_TO_NS(timespec_now.tv_sec) + timespec_now.tv_nsec;
*now = RCL_S_TO_NS((uint64_t)timespec_now.tv_sec) + timespec_now.tv_nsec;
return RCL_RET_OK;
}

Expand Down Expand Up @@ -97,7 +97,7 @@ rcl_steady_time_now(rcl_time_point_value_t * now)
RCL_SET_ERROR_MSG("unexpected negative time");
return RCL_RET_ERROR;
}
*now = RCL_S_TO_NS(timespec_now.tv_sec) + timespec_now.tv_nsec;
*now = RCL_S_TO_NS((uint64_t)timespec_now.tv_sec) + timespec_now.tv_nsec;
return RCL_RET_OK;
}

Expand Down

0 comments on commit 545cb56

Please sign in to comment.