Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: printf format question

In article <>,
Paul Goyette  <> wrote:
>I know I'm mising something totally basic and obvious, but what format 
>specifier should I use when printing a variable of type clock_t ?
>On amd64, a clock_t is typedef'd to "unsigned int" and printf %u works 
>fine.  But on i386, clock_t is typedef'd to "unsigned long" and requires 
>printf %lu, and both %u and %llu fail to compile.  There doesn't seem to 
>be any entry in i386/int_fmtio.h that equates to %lu
>So, what is the correct printf format to use?

Well clock_t is used in times(3) and siginfo(2) child struct return. It is
either int, unsigned int, or long depending on arch. I think the standard
wants it to be a large signed quantity so perhaps we should just make it
int64_t which would require us to version siginfo and utimes, but make
utimes useful for boot times > 1 year, or we can just leave things as they
are and cast to long when printing.


Home | Main Index | Thread Index | Old Index