[PATCH] Change time_t to 64-bit by default
Freddie Chopin
freddie_chopin@op.pl
Thu Sep 7 16:03:00 GMT 2017
On Thu, 2017-09-07 at 15:00 +0200, Sebastian Huber wrote:
> The casts in Newlib gmtime_r() look pretty useless. I will send a
> patch
> with:
>
> diff --git a/newlib/libc/time/gmtime_r.c
> b/newlib/libc/time/gmtime_r.c
> index 81c7c94b1..6475df3ba 100644
> --- a/newlib/libc/time/gmtime_r.c
> +++ b/newlib/libc/time/gmtime_r.c
> @@ -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;
You should also replace "long days, rem;" with "time_t days, rem;".
Regards,
FCh
More information about the Newlib
mailing list