summaryrefslogtreecommitdiff
path: root/TAO/examples/Simple/time-date/Time_Date_i.cpp
blob: 05d0a0858545d4c46f606bae93205354797a286e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// -*- C++ -*-
#include "Time_Date_i.h"
#include "ace/OS_NS_time.h"
#include "ace/Reactor.h"

// Obtain the time and date in binary format.
void
Time_Date_i::bin_date (CORBA::Long_out time_date)
{
  time_date = static_cast<CORBA::Long> (ACE_OS::time (0));
}

// Obtain the time and date in string format.
void
Time_Date_i::str_date (CORBA::String_out time_date)
{
  const time_t time = ACE_OS::time (0);

  time_date = CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR(ACE_OS::ctime (&time)));
}

// Shutdown.
void
Time_Date_i::shutdown (void)
{
  ACE_DEBUG ((LM_DEBUG,
              ACE_TEXT ("Time_Date_i is shutting down\n")));

  // Instruct the ORB to shutdown.
  this->orb_var_->shutdown ();
  // And shutdown the event loop from started in main.
  ACE_Reactor::end_event_loop ();
}

void
Time_Date_i::orb (CORBA::ORB_ptr orb_ptr)
{
  orb_var_ = CORBA::ORB::_duplicate (orb_ptr);
}