This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [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
- From: Jeff Johnston <jjohnstn at redhat dot com>
- To: Freddie Chopin <freddie_chopin at op dot pl>
- Cc: newlib at sourceware dot org
- Date: Thu, 11 Sep 2014 15:51:26 -0400 (EDT)
- Subject: Re: [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
- Authentication-results: sourceware.org; auth=none
- References: <54077334 dot 6050804 at op dot pl> <540A36F0 dot 6090903 at op dot pl> <540F7654 dot 7070403 at op dot pl>
Hi Freddie,
Corinna who was looking at this previously is on vacation so I am reviewing it.
The only comments I have are:
1. month_lengths needs to be renamed to be __month_lengths because it is now externalized.
2. you might as well be consistent with other files in LIB_SOURCES list of Makefile.am with regards to tabs vs spaces.
-- Jeff J.
----- Original Message -----
> From: "Freddie Chopin" <freddie_chopin@op.pl>
> To: newlib@sourceware.org
> Sent: Tuesday, September 9, 2014 5:51:16 PM
> Subject: Re: [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
>
> 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
>
- References:
- [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
- Re: [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
- Re: [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