RTEMS: Time registration when dynamically loading

The old test for discriminating between statically and dynamically
linked applications (os/RTEMS/osdTime.cpp:staticTimeRegister()) is
wrong, it never detects a dynamically loaded app.

fixes lp:831648
-------------- This line and the following will be ignored
--------------

modified:
  src/libCom/osi/os/RTEMS/osdTime.cpp
This commit is contained in:
Till Straumann
2011-08-23 13:20:00 -05:00
committed by Andrew Johnson
parent 2b4edba8f3
commit 2b65025d93

View File

@@ -18,6 +18,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <rtems/rtems_bsdnet_internal.h>
#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();