[PATCH] libc/time/gmtime_r.c, libc/time/lcltime_r.c,, libc/time/local.h, libc/time/mktm_r.c: move localtime related functionality, from _mktm_r() to new _mklocaltm_r() to break dependency of gmtime() on, timezones

Freddie Chopin freddie_chopin@op.pl
Tue Sep 9 21:51:00 GMT 2014


W dniu 2014-09-06 00:19, Freddie Chopin pisze:
> Hello!
>
> Modified patch (with ChangeLog entry) attached.
>
> This time I have gone a bit further, the summary of changes is contained
> in the patch, but I'm pasting it here for clarity:
>
> libc/time: Remove dependency of gmtime() on time zone related code
>
> 1. Move mon_lengths array to new file, rename to month_lengths
> 2. Move __tzcalc_limits() to new file
> 3. Move time zone related part of _mktm_r() to localtime_r(), before
> performing these time zone adjustments call gmtime_r()
> 4. Move remaining part of _mktm_r() to gmtime_r()
> 5. Remove mktm_r.c
> 6. Modify Makefile.am and regenerate Makefile.in
>
> The gain when using gmtime() only is the same as previously. It is also
> worth noting that with this change (just as with the previous version)
> if you have BOTH gmtime() and localtime() calls in your code it will be
> a bit bigger than before - about 150B of .text (on ARM Cortex-M3) - this
> is because now the code is spread between two functions, with a little
> bit of duplication of initializations, while previously it was only one
> function, so the compiler was able to optimize and reuse variables.
>
> I hope that this time I did that right (;
>
> Regards,
> FCh

Any comments? (;

Regards,
FCh



More information about the Newlib mailing list