added vxWorks support

This commit is contained in:
Jeff Hill
1996-09-04 21:54:56 +00:00
parent 6440239832
commit 5b546d2467

View File

@@ -1,8 +1,6 @@
#include <osiTime.h>
#include <sys/types.h>
#include <sys/time.h>
#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 <sys/types.h>
# include <sys/time.h>
//
// 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 <tickLib.h>
# include <sysLib.h>
//
// 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