time_t printf()

Edwin Groothuis edwin at mavetju.org
Sun Jan 8 02:34:10 PST 2006


Trying to printf() a time_t value, I tried the following permutations:

    time_t days = 0, hours = 0, minutes = 0, seconds = 0;
    sprintf(buffer, "%2d %2u %2ld %2lu", days, hours, minutes, seconds);

4.11 said:
    misc.c:117: warning: int format, time_t arg (arg 3)
    misc.c:117: warning: unsigned int format, long unsigned int arg (arg 4)

6.0 said:
    misc.c:117: warning: long int format, time_t arg (arg 5)
    misc.c:117: warning: long unsigned int format, time_t arg (arg 6)

So between 4.11 and 6.0 there is no uniform way to printf() time_t
values...

Edwin

-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin at mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/


More information about the freebsd-ports mailing list