← Back to team overview

yade-dev team mailing list archive

Re: CLOCK_MONOTONIC portability

 

> I'm currently trying to compile yade on Mac OS X (Leopard).
> for the moment, all optional packages are disabled and also qt3.
> My problem is about clock_gettime(CLOCK_MONOLITIC) that seem to be  
> not support by this OS.
> It appears only one time in the file core/Timing.hpp coded by Vaclav.
> 
> Do you know an alternative so that I can compile on Mac ?
> If not, could I use sometime like:
> 
> #ifdef __APPLE__
> // do something (or nothing)
> #else
> clock_gettime(CLOCK_MMONOLITIC);
> #endif

I assume you mean CLOCK_MONOTONIC -- it is clock source that ensures
that it is, well, monotonic (i.e. resistent to leap seconds, changing hw
clock etc).

I don't know what works on leopard, try man clock_gettime. 

STFW gives
http://www.wand.net.nz/~smr26/wordpress/2009/01/19/monotonic-time-in-mac-os-x/

In the worst case, you could just return 0 and warn, it is not critical
part of yade, but used for profiling (timing.stats() &comp, see
http://yade.wikia.com/wiki/Speed_profiling_using_TimingInfo_and_TimingDeltas_classes) which would give bogus results at apple. Oh well. Who is interested in those overpriced machines for running yade seriously?

V.







Follow ups

References