On Sun, 2007-05-06 at 18:07 -0400, Guy Hulbert wrote:
> Ugh.  I bet Wietse just uses strftime.
> 
> $ cd tmp
> $ apt-get source postfix
> $ find -name '*.c' -exec grep 'strftime' '{}' \; | wc
>       7      46     454
> 
> There.  I win :-)

I realize (after I hit send :-), of course, that he may have been
deprecating its use but here is what he does in src/global/mail_date.c

    /*
     * As if strftime() isn't expensive enough, we're dynamically adjusting
     * the size for the result, so we won't be surprised by long names etc.
     */
[snip]

#ifdef MISSING_STRFTIME_E
#define STRFTIME_FMT "%a, %d %b %Y %H:%M:%S "
#else
#define STRFTIME_FMT "%a, %e %b %Y %H:%M:%S "
#endif

[snip]

    /*
     * Then, add the UTC offset.
     */
    if (gmtoff < -DAY_MIN || gmtoff > DAY_MIN)
        msg_panic("UTC time offset %d is larger than one day", gmtoff);
    vstring_sprintf_append(vp, "%+03d%02d", (int) (gmtoff / HOUR_MIN),
                           (int) (abs(gmtoff) % HOUR_MIN));

[snip]

    /*
     * Finally, add the time zone name.
     */
    while (strftime(vstring_end(vp), vstring_avail(vp), " (%Z)", lt) == 0)
        VSTRING_SPACE(vp, vstring_avail(vp) + 100);
    VSTRING_SKIP(vp);


-- 
--gh


Reply via email to