Boost logo

Boost :

Subject: Re: [boost] [chrono] Thread clock compatibility problems on Android
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-05-13 12:11:47

Libor Bus wrote:
> Hello,
> has anybody experienced also compatibility problems of chrono library on
> Android? I found following (Android 2.2, NDK-r5b, chrono v0.71, rev
> #71693):
> 1) Sources with boost::chrono::thread_clock does not compile, since
> _POSIX_THREAD_CPUTIME is not defined on Android. My workaround is to hack
> chrono/config.hpp:
> # if 1 //defined(_POSIX_THREAD_CPUTIME)
> # endif

I don't know Android. Do you know which is the macros used by Boost to
identify Android? Or some macro that is always defined when compiling on

It will be better to use this macro instead of commenting the condition.

> 2) ::clock_gettime() fails when called with clock ID got from
> pthread_getcpuclockid. My workaround is to call ::clock_gettime(
> chrono/detail/inlined/posix/thread_clock.hpp.

Again I will need a specific macro to include this specific code.

> 3) Additionally there is precision problem on Linux platforms,
> stopwatch<process_cpu_clock> provides results with different units on
> Windows (nanoseconds) and Linux platforms (miliseconds).

I don't remember why there were different, but what is wrong on providing
the best precession provided by the platform?

Please, could you create a ticket on Trac, so we don't forget.
Thanks for the report, I will try to correct it as soon I have a macro to
make the difference.


View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at