diff options
author | msmit <msmit@remedy.nl> | 2010-03-29 12:28:24 +0000 |
---|---|---|
committer | msmit <msmit@remedy.nl> | 2010-03-29 12:28:24 +0000 |
commit | 337a0f40e9e1d9b3c2b9792bada9efbedb62a67e (patch) | |
tree | 615f460e4ff74386b241b5793b5661bd30924d1f /ACE/tests/NDDS_Timer_Test.cpp | |
parent | f37f85fe7dabaa67ace9c61918bb6a650148f0c8 (diff) | |
download | ATCD-337a0f40e9e1d9b3c2b9792bada9efbedb62a67e.tar.gz |
Mon Mar 29 12:25:38 UTC 2010 Marcel Smit <msmit@remedy.nl>
* tests/NDDS_Timer_Test.cpp:
Resolved test issues.
Diffstat (limited to 'ACE/tests/NDDS_Timer_Test.cpp')
-rw-r--r-- | ACE/tests/NDDS_Timer_Test.cpp | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/ACE/tests/NDDS_Timer_Test.cpp b/ACE/tests/NDDS_Timer_Test.cpp index c7b6a79c857..5b1c8b7c244 100644 --- a/ACE/tests/NDDS_Timer_Test.cpp +++ b/ACE/tests/NDDS_Timer_Test.cpp @@ -83,10 +83,9 @@ check_micro_nano (unsigned long long microinterval, unsigned long long nanointer } static -DDS_Duration_t +void time_interval (const DDS_Duration_t& interval, - unsigned long long& nanoseconds, - unsigned long long& microseconds) + RTINtpTime& duration) { RTIClock *timer = RTIHighResolutionClock_new(); @@ -105,18 +104,7 @@ time_interval (const DDS_Duration_t& interval, timer->getTime(timer, &finish_time); // Measure. - struct RTINtpTime duration; RTINtpTime_subtract(duration, finish_time, start_time); - - int s; - RTINtpTime_unpackToMicrosec (s, microseconds, duration); - RTINtpTime_unpackToNanosec (s, nanoseconds, duration); - - DDS_Duration_t measured; - measured.sec = duration.sec; - measured.nanosec = nanoseconds; - - return measured; } @@ -155,16 +143,19 @@ run_main (int argc, ACE_TCHAR *argv[]) interval.sec = 0; interval.nanosec = intervals[i] * 1000; - unsigned long long nanoseconds; - unsigned long long microseconds; - DDS_Duration_t const measured = time_interval (interval, - nanoseconds, - microseconds); + RTINtpTime duration; + time_interval (interval, duration); + + unsigned long long microseconds, nanoseconds; + int sec; + RTINtpTime_unpackToMicrosec (sec, microseconds, duration); + RTINtpTime_unpackToNanosec (sec, nanoseconds, duration); time_t const interval_usec = interval.sec * ACE_ONE_SECOND_IN_USECS + interval.nanosec / 1000; time_t const measured_usec = - measured.sec * ACE_ONE_SECOND_IN_USECS + measured.nanosec / 1000; + sec * ACE_ONE_SECOND_IN_USECS + microseconds; + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("interval: %: usec, measured: %: usec %s\n"), @@ -178,25 +169,14 @@ run_main (int argc, ACE_TCHAR *argv[]) { errors += check (interval.sec * ACE_ONE_SECOND_IN_USECS + interval.nanosec / 1000, - measured.sec * ACE_ONE_SECOND_IN_USECS - + measured.nanosec / 1000); + sec * ACE_ONE_SECOND_IN_USECS + microseconds); // Don't check for error for intervals below 10 msec. } - // Check the ACE_Timer_Value-calculated microseconds against - // the ACE_NDDS_Timer-calculated nanoseconds. - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("DDS_Duration usec: %:, HR nsec: %Q\n"), - measured_usec, - nanoseconds)); - // This gives problems -> should be fixed - errors += check_micro_nano (measured.sec * ACE_ONE_SECOND_IN_USECS - + measured.nanosec / 1000, - nanoseconds); + errors += check_micro_nano (microseconds, nanoseconds); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("NDDS_Timer usec: %Q, nsec: %Q\n"), microseconds, nanoseconds)); - errors += check_micro_nano (microseconds, nanoseconds); } } |