OK I verified that that's the case. It seems to have to do with the reference clock in use.
I verified that __wrap_clock_gettime(CLOCK_REALTIME, ...)
or __wrap_clock_gettime(CLOCK_MONOTONIC, ...)
give a similar result. However, there seems to be a CLOCK_HOST_REALTIME
defined by Xenomai which seems to return the correct date. That define evaluates to 32, so you could do this:
extern int __wrap_clock_gettime(clockid_t clk_id, struct timespec *tp);
...
struct timespec tp;
__wrap_clock_gettime(32, &tp);
secondes = tp.tv_sec;
...
this should give you the desired result.
BTW, there's plenty of duplicated code in your external that you may want to tidy up all in one place (namely, the calls to time() and localtime_r()). Also, it looks like when you call ahora_bang()
the behaviour is to output values from all outputs starting from the one set in the creation argument. Is that expected/desired or are should you have a break
at the end of each case
statement?