[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: printf format question
In article <Pine.NEB.4.64.1012251909130.22911%quicky.whooppee.com@localhost>,
Paul Goyette <paul%whooppee.com@localhost> 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.
Main Index |
Thread Index |