This is the mail archive of the 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]

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


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 and regenerate

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 (;


Attachment: 0001-libc-time-Remove-dependency-of-gmtime-on-time-zone-r.patch
Description: Text document

Attachment: ChangeLog.txt
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]