Skip to content

Commit

Permalink
Fix warning when converting string to Time_t (#2402)
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>
(cherry picked from commit b5f7fbf)

Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
  • Loading branch information
mergify[bot] and clalancette authored Jan 12, 2022
1 parent 2c9fcb7 commit c4c9afd
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 @@ -369,7 +369,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 @@ -382,6 +382,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 c4c9afd

Please sign in to comment.