diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-12-07 04:55:00 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-12-07 04:55:00 +0000 |
commit | 4104ad592fc3c0eee3fbbf9af2662bc07b6768fa (patch) | |
tree | 1e22a0d6dd74713e5a4ecc5728d9bc415f3baad2 | |
parent | afd097102ca8e31502e40a180170f03a5d6c08b2 (diff) | |
download | ATCD-4104ad592fc3c0eee3fbbf9af2662bc07b6768fa.tar.gz |
ACE_OS::gettimeofday (): VxWorks returns nsec instead of usec, so convert
-rw-r--r-- | ace/OS.i | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -3567,10 +3567,15 @@ ACE_OS::gettimeofday (void) #if defined (ACE_HAS_TIMEZONE_GETTIMEOFDAY) || (defined (ACE_HAS_SVR4_GETTIMEOFDAY) && !defined (m88k)) ACE_OSCALL (::gettimeofday (&tv, 0), int, -1, result); #elif defined (VXWORKS) - // assumes that struct timespec is same size as struct timeval, - // which assumes that time_t is a long: it currently (v 5.2) is - ACE_OSCALL (ACE_ADAPT_RETVAL (::clock_gettime (CLOCK_REALTIME, (struct timespec *) &tv), result), + // 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); + + tv.tv_sec = ts.tv_sec; + tv.tv_usec = ts.tv_nsec / 1000L; // timespec has nsec, but timeval has usec #else ACE_OSCALL (::gettimeofday (&tv), int, -1, result); #endif /* ACE_HAS_SVR4_GETTIMEOFDAY */ |