diff options
author | vishal <vishal@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-16 17:21:20 +0000 |
---|---|---|
committer | vishal <vishal@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-16 17:21:20 +0000 |
commit | f30610f733c84f403dbb50cfba6fc218824a0fd1 (patch) | |
tree | e9b197384a0fa15567a76c08e930cab59f197c08 | |
parent | f63ca383842037310a3f4dc4e79d528974a5a840 (diff) | |
download | ATCD-f30610f733c84f403dbb50cfba6fc218824a0fd1.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/orbsvcs/Time_Service/Clerk_i.cpp | 14 | ||||
-rw-r--r-- | TAO/orbsvcs/Time_Service/Clerk_i.h | 5 | ||||
-rw-r--r-- | TAO/orbsvcs/Time_Service/Server_i.cpp | 21 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h | 1 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Server.cpp | 24 |
6 files changed, 40 insertions, 28 deletions
diff --git a/TAO/orbsvcs/Time_Service/Clerk_i.cpp b/TAO/orbsvcs/Time_Service/Clerk_i.cpp index a80fb4611c6..d0896e7e994 100644 --- a/TAO/orbsvcs/Time_Service/Clerk_i.cpp +++ b/TAO/orbsvcs/Time_Service/Clerk_i.cpp @@ -101,7 +101,7 @@ Clerk_i::read_ior (const char *filename) int Clerk_i::parse_args (void) { - ACE_Get_Opt get_opts (this->argc_, this->argv_, "dt:f:o:"); + ACE_Get_Opt get_opts (this->argc_, this->argv_, "dt:u:f:o:"); int c, result; @@ -112,10 +112,16 @@ Clerk_i::parse_args (void) TAO_debug_level++; break; - case 't': // time after which the clerk should update time. + case 't': // time in secs after which the clerk should update time. this->timer_value_ = atoi (get_opts.optarg); break; + case 'u': + // time in usecs after which the clerk should update time. + // Continues the precision of the -t option. + this->timer_value_usecs_ = atoi (get_opts.optarg); + break; + case 'f': // read the server IORs from a file. result = this->read_ior (get_opts.optarg); @@ -143,7 +149,8 @@ Clerk_i::parse_args (void) "[SERVER] Process/Thread Id : (%P/%t)" "usage: %s" " [-d]" - " [-t] <Timer value>" + " [-t] <Timer value inn Secs>" + " [-u] <Timer value in uSecs>" " [-f] <ior_input_file>" " [-o] <ior_output_file>" "\n", @@ -347,6 +354,7 @@ Clerk_i::create_clerk (void) // of server IORs and the no. of servers. ACE_NEW_RETURN (this->time_service_clerk_impl_, TAO_Time_Service_Clerk (this->timer_value_, + this->timer_value_usecs_, this->server_), 0); diff --git a/TAO/orbsvcs/Time_Service/Clerk_i.h b/TAO/orbsvcs/Time_Service/Clerk_i.h index 8c826d4872c..fed64f2e4cd 100644 --- a/TAO/orbsvcs/Time_Service/Clerk_i.h +++ b/TAO/orbsvcs/Time_Service/Clerk_i.h @@ -122,9 +122,12 @@ private: // My orb. int timer_value_ ; - // Clerk seeks time periodically after this interval from the + // Clerk seeks time periodically after this interval in secs. from the // servers in the network. + int timer_value_usecs_; + // Continues the precision of timer_value_ in microseconds. + // IR_Helper *ir_helper_; // Helper class for using the IR. diff --git a/TAO/orbsvcs/Time_Service/Server_i.cpp b/TAO/orbsvcs/Time_Service/Server_i.cpp index 8a1f78f6fa4..581a6f0b48c 100644 --- a/TAO/orbsvcs/Time_Service/Server_i.cpp +++ b/TAO/orbsvcs/Time_Service/Server_i.cpp @@ -54,7 +54,6 @@ Server_i::parse_args (void) " [-d]" " [-o] <ior_output_file>" " [-i] <Use the Implementation Repository>" - " [-r] <Register with the Implementation Repository>" "\n", argv_ [0]), 1); @@ -75,10 +74,10 @@ Server_i::init_naming_service (CORBA::Environment &ACE_TRY_ENV) // Initialize the POA. this->orb_manager_.init_child_poa (this->argc_, this->argv_, - "time_server", + "child_poa", ACE_TRY_ENV); ACE_TRY_CHECK; - + PortableServer::POA_ptr child_poa = this->orb_manager_.child_poa (); @@ -96,6 +95,7 @@ Server_i::init_naming_service (CORBA::Environment &ACE_TRY_ENV) { ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "(%P|%t) Exception from init_naming_service ()\n"); + return -1; } ACE_ENDTRY; @@ -172,13 +172,7 @@ Server_i::create_server (void) TAO_Time_Service_Server(this->use_ir_), 0); - // Generate IOR of the <TimeService Server> and register with - // POA. - //this->time_service_server_ = - //time_service_server_impl_->_this (); - // Register a servant with the child poa. - CORBA::String_var server_str = this->orb_manager_.activate_under_child_poa ("server", this->time_service_server_impl_, @@ -318,7 +312,7 @@ Server_i::register_server (void) ACE_CATCHANY { ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "(%P|%t) Exception from init_naming_service ()\n"); + "(%P|%t) Exception from Register Server ()\n"); return -1; } ACE_ENDTRY; @@ -354,6 +348,10 @@ Server_i::init (int argc, -1); ACE_TRY_CHECK; + // Activate the POA Manager. + this->orb_manager_.activate_poa_manager (ACE_TRY_ENV); + ACE_TRY_CHECK; + int result = this->parse_args (); if (result != 0) @@ -425,3 +423,6 @@ Server_i::run (CORBA::Environment &ACE_TRY_ENV) return 0; } + + + diff --git a/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp b/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp index 75f03baa49d..555d249505b 100644 --- a/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp +++ b/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp @@ -7,6 +7,7 @@ // Constructor. TAO_Time_Service_Clerk::TAO_Time_Service_Clerk (int timer_value, + int timer_value_usecs, const IORS& servers) : server_ (servers), helper_ (this) @@ -18,7 +19,7 @@ TAO_Time_Service_Clerk::TAO_Time_Service_Clerk (int timer_value, (&helper_, 0, ACE_Time_Value::zero, - ACE_Time_Value (timer_value)) == -1) + ACE_Time_Value(timer_value,timer_value_usecs)) == -1) ACE_ERROR ((LM_ERROR, "%p\n", "schedule_timer ()")); diff --git a/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h b/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h index 6805e8f844d..a33455bde0e 100644 --- a/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h +++ b/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h @@ -48,6 +48,7 @@ public: // = Initialization and termination methods. TAO_Time_Service_Clerk (int timer_value, + int timer_value_usecs, const IORS& server); // Constructor. diff --git a/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Server.cpp b/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Server.cpp index 81d560396ac..19293a6eeb4 100644 --- a/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Server.cpp +++ b/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Server.cpp @@ -24,12 +24,19 @@ TAO_Time_Service_Server::universal_time (CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, CosTime::TimeUnavailable)) { - TAO_UTO *uto = 0; - + TAO_UTO *uto = 0; + + // This is the difference in seconds between + // 15th October 1582 and 1st Jan 1970. It needs to be added to the system + // time to make the base time as 15th October 1582. + + const CORBA::ULongLong MAGIC_OFFSET = 12219290000; + // Return the local time of the system as a UTO. ACE_NEW_THROW_EX (uto, - TAO_UTO (ACE_static_cast(CORBA::ULongLong, - ACE_OS::gettimeofday ().sec ()) * + TAO_UTO ((MAGIC_OFFSET + + ACE_static_cast(CORBA::ULongLong, + ACE_OS::gettimeofday ().sec ())) * ACE_static_cast(ACE_UINT32, 10000000) + ACE_static_cast(CORBA::ULongLong, @@ -45,15 +52,6 @@ TAO_Time_Service_Server::universal_time (CORBA::Environment &ACE_TRY_ENV) return uto->_this (); - // In case we are using the IR. - // if (this->shutdown_ != 0) - // { - // TAO_ORB_Core_instance ()->orb ()->shutdown (); - - // ACE_DEBUG ((LM_DEBUG, - // "Shutting down the ORB\n")); - // } - } // This method returns the current time in a UTO only if the time can |