This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: CLK_TCK
Ulrich Drepper <drepper@redhat.com> writes:
> Andreas Jaeger <aj@suse.de> writes:
>
> > sysdeps/unix/sysv/linux/i386/bits/time.h uses:
> >
> > # if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
> > /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
> > presents the real value for clock ticks per second for the system. */
> > # include <bits/types.h>
> > extern long int __sysconf (int);
> > # define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */
> > # endif
> >
> > and time/time.h has:
> > # if defined __USE_POSIX && !defined __USE_XOPEN2K
> > # ifndef CLK_TCK
> > # define CLK_TCK CLOCKS_PER_SEC
> > # endif
> > # endif
> >
> > Why do we have both definitions?
>
> Not all <bits/time.h> files define CLK_TCK.
I see - but then both headers should use the same #ifdef. We
shouldn't use __STRICT_ANSI__ in one and __USE_POSIX in the other place.
> > With -D_GNU_SOURCE you don't get any at all since _GNU_SOURCE implies
> > __USE_XOPEN2K:
>
> And this is fine. CLK_TCK shouldn't be used. It has been removed
> from the standard.
Shouldn't we leave it in for _GNU_SOURCE ? Otherwise we break a
number of programs :-(
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj