summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-02-10 20:05:14 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-02-10 20:05:14 +0000
commit711f120deb9c4a2806b94b72315e3f6d06e915ee (patch)
treeddaddd1703726319915ed764de27c72add25d5fb /ace
parentc89adf98ed3b1f371e028ee10407205e05edf6d6 (diff)
downloadATCD-711f120deb9c4a2806b94b72315e3f6d06e915ee.tar.gz
added ACE_OS::clock_gettime ()
Diffstat (limited to 'ace')
-rw-r--r--ace/OS.h2
-rw-r--r--ace/OS.i16
2 files changed, 15 insertions, 3 deletions
diff --git a/ace/OS.h b/ace/OS.h
index fae029f99b0..220c00b5157 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -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);
diff --git a/ace/OS.i b/ace/OS.i
index b07431c78ed..31e9dc38714 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -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