Cleanup ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE, all platforms support it so far as I can...
[ACE_TAO.git] / TAO / tests / Explicit_Event_Loop / client.cpp
blobf59e174483e2128a39619ebc4da3a31059a5c45a
2 //=============================================================================
3 /**
4 * @file client.cpp
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
8 * @author Reading
9 * @author MA. Used with permission ofAddison-Wesley.Modified for TAO by Mike Moran <mm4@cs.wustl.edu>
11 //=============================================================================
14 #include "timeC.h"
16 #include "ace/Log_Msg.h"
18 // The following header is #included automatically by ACE+TAO.
19 // Therefore, they don't need to be included explicitly.
20 //#include <iostream.h>
21 //#include <iomanip.h>
23 int
24 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
26 try
28 // Initialize orb
29 CORBA::ORB_var orb = CORBA::ORB_init (argc,
30 argv);
32 // Check arguments.
33 if (argc != 2)
35 ACE_ERROR_RETURN ((LM_ERROR,
36 "Usage: client IOR_string\n"),
37 1);
40 // Destringify argv[1].
41 CORBA::Object_var obj = orb->string_to_object (argv[1]);
43 if (CORBA::is_nil (obj.in ()))
45 ACE_ERROR_RETURN ((LM_ERROR,
46 "Nil Time reference\n"),
47 1);
50 // Narrow.
51 Time_var tm = Time::_narrow (obj.in ());
53 if (CORBA::is_nil (tm.in ()))
55 ACE_ERROR_RETURN ((LM_ERROR,
56 "Argument is not a Time reference\n"),
57 1);
60 // Get time.
61 TimeOfDay tod = tm->get_gmt ();
63 ACE_DEBUG ((LM_DEBUG,
64 "%s%s%d:%s%d:%d\n",
65 "Time in Greenwich is ",
66 tod.hour < 10 ? "0" : "",
67 tod.hour,
68 tod.minute < 10 ? "0" : "",
69 tod.minute,
70 tod.second));
73 catch (const CORBA::Exception& ex)
75 ex._tao_print_exception ("client: a CORBA exception occurred");
76 return 1;
78 catch (...)
80 ACE_ERROR_RETURN ((LM_ERROR,
81 "client: an unknown exception was caught\n"),
82 1);
85 return 0;