diff --git a/src/libCom/osiTimeOSD.cc b/src/libCom/osiTimeOSD.cc index 5cde38655..f0b5f965e 100644 --- a/src/libCom/osiTimeOSD.cc +++ b/src/libCom/osiTimeOSD.cc @@ -1,8 +1,6 @@ #include -#include -#include #ifdef SUNOS4 extern "C" { @@ -10,17 +8,47 @@ int gettimeofday (struct timeval *tp, struct timezone *tzp); } #endif -// -// osiTime::getCurrent () -// -osiTime osiTime::getCurrent () -{ - int status; - struct timeval tv; - - status = gettimeofday (&tv, NULL); - assert (status==0); - - return osiTime(tv.tv_sec, tv.tv_usec * nSecPerUSec); -} +#if defined(UNIX) + +# include +# include + + // + // osiTime::getCurrent () + // + osiTime osiTime::getCurrent () + { + int status; + struct timeval tv; + + status = gettimeofday (&tv, NULL); + assert (status==0); + + return osiTime(tv.tv_sec, tv.tv_usec * nSecPerUSec); + } + +#elif defined(vxWorks) + +# include +# include + + // + // osiTime::getCurrent () + // + osiTime osiTime::getCurrent () + { + ULONG ticks; + ULONG sec; + ULONG nsec; + ULONG rate = sysClkRateGet(); + + ticks = tickGet(); + sec = ticks/rate; + nsec = (ticks%rate)*(nSecPerSec/rate); + + return osiTime(sec, nsec); + } +#else +# error please define an OS type +#endif