[IGSTK-Developers] TimeStamp and RealTimeClock and Mutex

Luis Ibanez luis.ibanez at kitware.com
Wed Feb 1 10:03:45 EST 2006


As a result of the efforts for raising code coverage,
a number of bugs were found hiding in the non-covered
lines.

Among those bugs, we encounter some issues with the
TimeStamp class. It was still using a call to clock()
in order to obtain the current time. As a result,
some TimeStamps didn't got enough resolution on their
time marks.

This call has now been replaced with a RealTimeClock,
but... unfortunately, the RealTimeClock doesn't have
a static method for providing the time. This forces
us to create a singleton that is shared among all the
TimeStamp classes (or worst to create a real time clock
inside every TimeStamp).

The singleton has been implemented and it is guarded
with Mutex locks. However, this mechanism is currently
making 15 tests fail in Windows.

It seems that the real solution to this problem is to
modify the RealTimeClock in order to offer a static
method that cat be invoked in order to get the time,
without having to create an object.

---

In order to implement that static method, the real
time clock may still need to have a Initialization()
method that is called before any other IGSTK class
is created.


Any suggestions are welcome.


    Luis






More information about the IGSTK-Developers mailing list