2 //=============================================================================
6 * @author Source code used in TAO has been modified and adapted from thecode provided in the book
7 * @author "Advanced CORBA Programming with C++"by Michi Henning and Steve Vinoski. Copyright1999. Addison-Wesley
9 * @author MA. Used with permission ofAddison-Wesley.Modified for TAO by Mike Moran <mm4@cs.wustl.edu>
11 //=============================================================================
15 #include <ace/streams.h>
16 #include <ace/OS_NS_time.h>
18 // The following headers are #included automatically by ACE+TAO.
19 // Therefore, they don't need to be included explicitly.
21 //#include <iostream.h>
27 time_t time_now
= ACE_OS::time (0);
28 struct tm
*time_p
= ACE_OS::gmtime (&time_now
);
31 tod
.hour
= time_p
->tm_hour
;
32 tod
.minute
= time_p
->tm_min
;
33 tod
.second
= time_p
->tm_sec
;
38 // Changelog for Henning and Vinoski's chapter 18 example
39 // ______________________________________________________
42 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
47 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
49 // Get reference to Root POA.
51 = orb
->resolve_initial_references ("RootPOA");
52 PortableServer::POA_var poa
53 = PortableServer::POA::_narrow (obj
.in ());
55 // Activate POA manager
56 PortableServer::POAManager_var mgr
57 = poa
->the_POAManager ();
61 Time_impl time_servant
;
63 // Write its stringified reference to stdout
64 Time_var tm
= time_servant
._this ();
65 CORBA::String_var str
= orb
->object_to_string (tm
.in ());
66 cout
<< str
.in () << endl
;
71 catch (const CORBA::Exception
&)
73 cerr
<< "Uncaught CORBA exception" << endl
;