[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
Thu Sep 4 13:36:00 GMT 2014


W dniu 2014-09-04 14:47, Joel Sherrill pisze:
> FWIW RTEMS has a test which has three tasks printing the time of day. Using gmtime or a friend to split the time into components to print is a sizeable chunk of the binary.
>
> No surprise that printf is also a large chunk.
>
> I can gather current size data for this test if you all think having it before and after is good.

Well, you'll only see any difference if you use gmtime() and don't use 
any time zone related code (like localtime()) anywhere... As you use 
RTOS anyway, the savings of not-needing time zone locking don't apply, 
because you need locking for other parts of the system anyway (like 
printf()).

If you can have such data without much effort then it would be nice to 
know, but if you need to set all that up then it's probably not worth 
the trouble - the savings are not especially big anyway (as I mentioned 
- for ARM Cortex-M3 - about 1kB of text and less than 100B in bss and 
data together).

The general idea is that the code will be smaller after this change (; 
Not "much smaller", but any savings that come at no price (the code 
won't be slower or use more RAM - it would probably use less) are 
worthwhile (;

Regards,
FCh



More information about the Newlib mailing list