avoid overflow on 32-bit machines when working with large ns values
This commit is contained in:
parent
b5a77f2233
commit
88db3d821a
1 changed files with 2 additions and 2 deletions
|
@ -66,7 +66,7 @@ rcl_system_time_now(rcl_time_point_value_t * now)
|
||||||
RCL_SET_ERROR_MSG("unexpected negative time");
|
RCL_SET_ERROR_MSG("unexpected negative time");
|
||||||
return RCL_RET_ERROR;
|
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;
|
return RCL_RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ rcl_steady_time_now(rcl_time_point_value_t * now)
|
||||||
RCL_SET_ERROR_MSG("unexpected negative time");
|
RCL_SET_ERROR_MSG("unexpected negative time");
|
||||||
return RCL_RET_ERROR;
|
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;
|
return RCL_RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue