Skip to content

Commit

Permalink
Fix configASSERT condition
Browse files Browse the repository at this point in the history
  • Loading branch information
chinglee-iot committed May 3, 2024
1 parent 5a30aaa commit a61132a
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -693,11 +693,11 @@ void calculateCurrentTime( UTCTime_t * pBaseTime,
if( currentTimeSecs > UINT32_MAX )
{
/* Assert when the UTC timestamp rollover. */
configASSERT( currentTimeSecs > UINT32_MAX );
configASSERT( !( currentTimeSecs > UINT32_MAX ));

/* Subtract an extra second as timestamp 0 represents the epoch for
* UTC era 1. */
LogError( ( "UTC timestamp rollover." ) );
LogWarn( ( "UTC timestamp rollover." ) );
pCurrentTime->secs = ( uint32_t ) ( currentTimeSecs - UINT32_MAX - 1 );
}
else
Expand All @@ -710,7 +710,7 @@ void calculateCurrentTime( UTCTime_t * pBaseTime,
else
{
pCurrentTime->secs = pBaseTime->secs;
pCurrentTime->msecs = msElapsedSinceLastSync;
pCurrentTime->msecs = ( uint32_t ) ( msElapsedSinceLastSync );
}
}

Expand Down Expand Up @@ -881,10 +881,11 @@ static void sntpClient_GetTime( SntpTimestamp_t * pCurrentTime )
if( ntpSecs > UINT32_MAX )
{
/* Assert when SNTP time rollover. */
configASSERT( ntpSecs > UINT32_MAX );
configASSERT( !( ntpSecs > UINT32_MAX ) );

/* Subtract an extra second as timestamp 0 represents the epoch for
* NTP era 1. */
LogWarn( ( "SNTP timestamp rollover." ) );
pCurrentTime->seconds = ntpSecs - UINT32_MAX - 1;
}
else
Expand Down

0 comments on commit a61132a

Please sign in to comment.