Remove harmful casts in gmtime_r()
In case time_t is long, then the cast to long is a nop. In case time_t is __int_least64_t, then the cast to long may truncate the value before the division. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
parent
f9205f1d47
commit
ad45b86533
|
@ -56,8 +56,8 @@ _DEFUN (gmtime_r, (tim_p, res),
|
|||
unsigned erayear, yearday, month, day;
|
||||
unsigned long eraday;
|
||||
|
||||
days = ((long)lcltime) / SECSPERDAY + EPOCH_ADJUSTMENT_DAYS;
|
||||
rem = ((long)lcltime) % SECSPERDAY;
|
||||
days = lcltime / SECSPERDAY + EPOCH_ADJUSTMENT_DAYS;
|
||||
rem = lcltime % SECSPERDAY;
|
||||
if (rem < 0)
|
||||
{
|
||||
rem += SECSPERDAY;
|
||||
|
|
Loading…
Reference in New Issue