This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, On Sep 3 21:59, Freddie Chopin wrote: > Hello again (; > > I attach patch and a ChangeLog entry with a bigger change to time-related > sources. > > Currently functions gmtime() and localtime() are both implemented with > common code in _mktm_r(), which decides whether to do time zone adjustments > by additional parameter - is_gmtime, true for gmtime() and false for > localtime(). This way if you use gmtime() and don't care about time zones, > you get them anyway in the final binary. > > This change moves all time zone related stuff from _mktm_r() to new function > _mklocaltm_r(). gmtime_r() still calls _mktm_r() (but with this boolean > parameter removed), while localtime_r() first calls _mktm_r() and then calls > _mklocaltm_r() using the result of _mktm_r(). > > This way you get time zone stuff in the final link only if it's really > needed - when you use localtime(). If you use just gmtime(), the time zone > functions are not linked, which saves about 1kB of flash and a little below > 100B of RAM (on ARM Cortex-M3). (the savings would be bigger if proper locks > are implemented - by default only stubs are used and no code for mutexes is > needed) How does that work? _mktm_r and _mklocaltm_r are still in the same source file, so if you get one, you also get the other. Where did you get your savings from? > Actually the names of the functions are not 100% good, but changing the name > of _mktm_r() to something clearer (_mkgmtime_r()?) should come with changing > the name of the source file, so I decided to leave that as it is... If you > think that the names should change too, I could modify the patch and extend > it. Since these are internal functions, I think the names are fine. Comments preceding _mktm_r and _mklocaltm_r would be nice. Corinna -- Corinna Vinschen Cygwin Maintainer Red Hat
Attachment:
pgp0A_nda4_ck.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |