This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2.2][BZ #12515] Improve precision of clock function
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Paul Eggert <eggert at cs dot ucla dot edu>
- Cc: Rich Felker <dalias at aerifal dot cx>, Siddhesh Poyarekar <siddhesh at redhat dot com>, libc-alpha at sourceware dot org
- Date: Wed, 12 Jun 2013 14:51:03 -0700 (PDT)
- Subject: Re: [PATCH v2.2][BZ #12515] Improve precision of clock function
- References: <519B9A09 dot 6030305 at cs dot ucla dot edu> <20130521161441 dot GQ8927 at spoyarek dot pnq dot redhat dot com> <20130603092604 dot GL2145 at spoyarek dot pnq dot redhat dot com> <20130610083821 dot GD1570 at spoyarek dot pnq dot redhat dot com> <51B66522 dot 1060008 at cs dot ucla dot edu> <20130611135422 dot GK8010 at spoyarek dot pnq dot redhat dot com> <20130611171952 dot EB3CF2C0A2 at topped-with-meat dot com> <20130612050307 dot GU8010 at spoyarek dot pnq dot redhat dot com> <20130612173819 dot 67B272C07E at topped-with-meat dot com> <20130612192718 dot GH19582 at spoyarek dot pnq dot redhat dot com> <20130612202701 dot GA29800 at brightrain dot aerifal dot cx> <51B8ECB0 dot 8030403 at cs dot ucla dot edu>
> We could do this by using gnulib's verify.h and then putting this into clock.c:
>
> #include <verify.h>
> verify (1000000000 % CLOCKS_PER_SEC == 0);
>
> Or if we'd rather not use gnulib's verify.h we could approximate
> its implementation of 'verify'; something like this:
It's a trivial macro, so:
#if CLOCKS_PER_SEC != 1000000
# error blah blah
#endif
is adequate.