Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 23 Aug 2020 10:24:39 +0200
From: Jens Gustedt <>
Subject: direct coding of asctime_r

I don't know if you guys noticed, but sometime ago we voted some of
the ..._r functions from <time.h> into the C standard, just to then
discover that POSIX has deprecated the whole set of functions and
proposes to replace them by `strftime`.

One of the arguments to keep them, was that `asctime_r` does not need
access to locale and has a fixed format, and so can be implemented
with a much smaller footprint.

Looking into musl I found that the current implementation is basically
doing verbatim what the C standard says, namely uses `snprintf` under
the hood to do the formatting. This has obviously the disadvantage
that this drags the whole infrastructure that is needed for `snprintf`
into the executable.

Making some tests, I found that coding `asctime_r` straight forward
with byte-copying has it shave off about 10k from the final

Would it be interesting for musl to change to such an implementation?

Shall I prepare a patch to do so?


:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: ::

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.