Skip to content

Commit

Permalink
Fix warning when converting string to Time_t (#2399)
Browse files Browse the repository at this point in the history
The Time_t nanosec() method requires a uint32_t to be passed in.
But the previous code was using an int32_t for the nanoseconds,
which was causing a warning in some compilers.  Fix this by
using a uint32_t for the nano variable.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
  • Loading branch information
clalancette authored Jan 12, 2022
1 parent 8b3586c commit b5f7fbf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/fastdds/rtps/common/Time_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ inline std::istream& operator >>(
{
char point;
int32_t sec = 0;
int32_t nano = 0;
uint32_t nano = 0;
std::ios_base::iostate excp_mask = input.exceptions();

try
Expand All @@ -388,6 +388,7 @@ inline std::istream& operator >>(
if ( point != '.' || nano > 1000000000 )
{
input.setstate(std::ios_base::failbit);
nano = 0;
}
}
catch (std::ios_base::failure& )
Expand Down

0 comments on commit b5f7fbf

Please sign in to comment.