Hello,
We use Power PMAC(s) for Insertion Device motion controls. soft IOCs run on the Power PMACs.
As most of you already know, the Power PMAC runs Linux with a Xenomai real time kernel.
We have been trying to determine why the EPICS time stamps have been incorrect.
We determined that after a reboot of the machine:
- clock_gettime(CLOCK_REALTIME, &clockNow) functions would return the time since reboot. This does not correlate with the Xenomai API which states it should be the time since EPOCH
- As a result when the first IOC is launched after a reboot, the following logic from /src/libCom/osi/osiClockTime.c is invoked
if (!ClockTimePvt.synchronized &&
clockNow.tv_sec < POSIX_TIME_AT_EPICS_EPOCH) {
clockNow.tv_sec = POSIX_TIME_AT_EPICS_EPOCH + 86400;
clockNow.tv_nsec = 0;
clock_settime(CLOCK_REALTIME, &clockNow);
errlogPrintf("WARNING: OS Clock time was read before being set.\n"
"Using 1990-01-02 00:00:00.000000 UTC\n");
}
- This then sets the time to 1990-01-02 after which subsequent IOCs use this time
- Strangely the time() function in <time.h> returns the correct time regardless of whether the machine has been rebooted.
- I have contacted Delta Tau and asked them if they know about this phenomenon
- As a "quick" fix to the issue, I am calling clock_settime() with the value of time() after a reboot, however I do not think this allows for NTP corrections.
I hope this helps anyone else out there who is enjoying the "nuances" or the Power PMAC.
Choon