diff --git a/src/libCom/osi/os/RTEMS/osdTime.cpp b/src/libCom/osi/os/RTEMS/osdTime.cpp index b7ff6ee08..acefa1b09 100644 --- a/src/libCom/osi/os/RTEMS/osdTime.cpp +++ b/src/libCom/osi/os/RTEMS/osdTime.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include "epicsTime.h" #include "osdTime.h" #include "osiNTPTime.h" @@ -117,17 +118,21 @@ double rtemsTicksPerSecond_double, rtemsTicksPerTwoSeconds_double; * explicitly calls osdTimeRegister() at the appropriate time. * However if we are loaded dynamically we *do* register our * standard time providers at static constructor time; in this - * case the tick rate will have been set already. + * case the network is available already. */ static int staticTimeRegister(void) { - if (rtemsTicksPerSecond != 0) - osdTimeRegister(); - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_PER_SECOND, &rtemsTicksPerSecond); rtemsTicksPerSecond_double = rtemsTicksPerSecond; rtemsTicksPerTwoSeconds_double = rtemsTicksPerSecond_double * 2.0; + /* If networking is already up at the time static constructors + * are executed then we are probably run-time loaded and it's + * OK to osdTimeRegister() at this point. + */ + if (rtems_bsdnet_ticks_per_second != 0) + osdTimeRegister(); + return 1; } static int done = staticTimeRegister();