Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Timed_Buffered_Oneways / test_i.cpp
blob59e6db0265c1cfbca42bf00c3f2814b4db901329
1 #include "test_i.h"
2 #include "ace/OS_NS_unistd.h"
3 #include "ace/OS_NS_sys_time.h"
4 #include "ace/Time_Value.h"
6 test_i::test_i (CORBA::ORB_ptr orb)
7 : orb_ (CORBA::ORB::_duplicate (orb))
11 void
12 test_i::method (CORBA::ULong request_number,
13 CORBA::Long start_time,
14 const test::data &,
15 CORBA::ULong work)
17 ACE_Time_Value start (0);
18 // HPUX seems to require this cast
19 start.msec (static_cast<long> (start_time));
20 ACE_DEBUG ((LM_DEBUG,
21 "server:\t%d took\t%dms\n",
22 request_number,
23 (ACE_OS::gettimeofday () - start).msec ()));
25 // Time required to process this request. <work> is time units in
26 // milli seconds.
27 ACE_Time_Value work_time (0, work * 1000);
29 ACE_OS::sleep (work_time);
32 void
33 test_i::flush (void)
35 ACE_DEBUG ((LM_DEBUG, "server: got flush request\n"));
38 void
39 test_i::shutdown (CORBA::Long start_time)
41 ACE_Time_Value start (0);
42 start.msec (static_cast<long> (start_time)); // HPUX seems to require this cast
43 ACE_DEBUG ((LM_DEBUG, "server: Shutting down... (%dms)\n",
44 (ACE_OS::gettimeofday() - start).msec ()));
45 this->orb_->shutdown (0);