Time going backwards with clock_gettime(CLOCK_MONOTONIC, ...)

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Nov 13 07:11:04 UTC 2014

On 13/11/14 03:04, Mr. Andrei Chichak wrote:
>> >On 2014-November-12, at 17:54, Nick Withers<nick.withers at anu.edu.au>  wrote:
>> >Thanks for your help, any suggestions appreciated as I'm really going to
>> >want to fix this…
> My gut reaction would be to look for a calculation that is either overflowing or has an intermediate value that is being converted to a signed int (like when a 64 bit unsigned is expected).
> Just a thought.

No, the reason is that the counter reloads while interrupts are disabled and 
thus the corresponding global variable reflects the old cycle.

The clock driver infrastructure is broken.  We try currently to get a budget to 
introduce the FreeBSD timecounters which will fix this and other problems.

Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

More information about the users mailing list