diff options
-rw-r--r-- | ace/OS.h | 2 | ||||
-rw-r--r-- | ace/OS.i | 16 |
2 files changed, 15 insertions, 3 deletions
@@ -288,6 +288,7 @@ typedef struct timespec time_t tv_sec; // Seconds long tv_nsec; // Nanoseconds } timespec_t; +typedef int clockid_t; #elif defined (ACE_HAS_BROKEN_POSIX_TIME) // OSF/1 defines struct timespec in <sys/timers.h> - Tom Marrs #include /**/ <sys/timers.h> @@ -2378,6 +2379,7 @@ public: // = A set of wrappers for timers and resource stats. static u_int alarm (u_int delay); static ACE_hrtime_t gethrtime (void); + static int clock_gettime (clockid_t, struct timespec *); static ACE_Time_Value gettimeofday (void); static int getrusage (int who, struct rusage *rusage); static int getrlimit (int resource, struct rlimit *rl); @@ -4045,6 +4045,17 @@ ACE_OS::readv (ACE_HANDLE handle, ACE_OSCALL_RETURN (::readv (handle, iov, iovlen), ssize_t, -1); } +ACE_INLINE int +ACE_OS::clock_gettime (clockid_t clockid, struct timespec *ts) +{ + // ACE_TRACE ("ACE_OS::clock_gettime"); +#if defined ACE_HAS_POSIX_TIME + ACE_OSCALL_RETURN (::clock_gettime (clockid, ts), int, -1); +#else + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_POSIX_TIME */ +} + ACE_INLINE ACE_Time_Value ACE_OS::gettimeofday (void) { @@ -4089,9 +4100,8 @@ ACE_OS::gettimeofday (void) // Assumes that struct timespec is same size as struct timeval, // which assumes that time_t is a long: it currently (VxWorks 5.2/5.3) is. struct timespec ts; - - ACE_OSCALL (ACE_ADAPT_RETVAL (::clock_gettime (CLOCK_REALTIME, &ts), result), - int, -1, result); + + ACE_OS::clock_gettime (CLOCK_REALTIME, &ts); tv.tv_sec = ts.tv_sec; tv.tv_usec = ts.tv_nsec / 1000L; // timespec has nsec, but timeval has usec |