This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] A steadier steady_clock
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: Sam Varshavchik <mrsam at courier-mta dot com>
- Cc: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Sun, 21 Oct 2012 23:07:41 +0200
- Subject: Re: [PATCH] A steadier steady_clock
- References: <cone.1350828020.51066.30326.1000@monster.email-scan.com>
* Sam Varshavchik:
> Based on a casual browsing of clock_gettime(3), CLOCK_MONOTONIC_RAW
> seems to be a better fit for std::chrono::steady_clock's requirements
> as given in 20.11.7.2, with recent Linux kernels,
Are the Linux clock semantics documented somewhere in detail?
> +#ifdef CLOCK_MONOTONIC_RAW
> + clock_gettime(CLOCK_MONOTONIC_RAW, &tp);
> +#else
> clock_gettime(CLOCK_MONOTONIC, &tp);
> +#endif
If a #define is available at compile time, it's not necessarily the
case that the feature is present at run time. If CLOCK_MONOTONIC_RAW
is indeed what we want, we need fallback code.