diff options
author | vishal <vishal@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-03-14 03:53:24 +0000 |
---|---|---|
committer | vishal <vishal@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-03-14 03:53:24 +0000 |
commit | 29dcb50adb843a3c5457b39cdaf1f48477ccb6f9 (patch) | |
tree | 1d2be9e65b34e25f3aebb275d7dfa659075847b3 /TAO/orbsvcs/orbsvcs/Time | |
parent | 9f6b50d20abf8be243b9486a2d9cccb64975591d (diff) | |
download | ATCD-29dcb50adb843a3c5457b39cdaf1f48477ccb6f9.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Time')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp | 25 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h | 15 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Time/TAO_UTO.cpp | 20 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp | 26 |
4 files changed, 75 insertions, 11 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp b/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp index f957b80b77d..0d6c37311af 100644 --- a/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp +++ b/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp @@ -37,10 +37,10 @@ CosTime::UTO_ptr TAO_Time_Service_Clerk::universal_time (CORBA::Environment &TAO_IN_ENV) { TAO_UTO *uto = 0; - + ACE_NEW_THROW_RETURN (uto, TAO_UTO (this->get_time (), - 0, + this->inaccuracy (), this->time_displacement_factor ()), CORBA::NO_MEMORY (CORBA::COMPLETED_NO), CosTime::UTO::_nil ()); @@ -87,9 +87,16 @@ TAO_Time_Service_Clerk::uto_from_utc (const TimeBase::UtcT &utc, { TAO_UTO *uto = 0; + // Use the low and high values of inaccuracy + // to calculate the total inaccuracy. + + TimeBase::InaccuracyT inaccuracy = utc.inacchi; + inaccuracy <<= 32; + inaccuracy |= utc.inacclo; + ACE_NEW_THROW_RETURN (uto, TAO_UTO (utc.time, - utc.inacclo + utc.inacchi, + inaccuracy, utc.tdf), CORBA::NO_MEMORY (CORBA::COMPLETED_NO), CosTime::UTO::_nil ()); @@ -142,6 +149,18 @@ TAO_Time_Service_Clerk::time_displacement_factor (CORBA::Short tdf) this->time_displacement_factor_ = tdf; } +// GET method for inaccuracy. +TimeBase::InaccuracyT +TAO_Time_Service_Clerk::inaccuracy (void) +{ + return this->inaccuracy_; +} +// SET method for inaccuracy. +void +TAO_Time_Service_Clerk::inaccuracy (TimeBase::InaccuracyT inaccuracy) +{ + this->inaccuracy_ = inaccuracy; +} diff --git a/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h b/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h index 976c0f576d6..bf1dc48e071 100644 --- a/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h +++ b/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h @@ -85,13 +85,19 @@ public: void name_server (TAO_Naming_Server &server); // This method is called by the driver program to set the Naming // Server instance. - + CORBA::Short time_displacement_factor (void); // Returns the time displacement factor. - + void time_displacement_factor (CORBA::Short); // Set the TDF. - + + TimeBase::InaccuracyT inaccuracy (void); + // GET method for inaccuracy. + + void inaccuracy (TimeBase::InaccuracyT inaccuracy); + // SET method for inaccuracy. + CORBA::ULongLong time_; // Clerk's notion of time. @@ -100,6 +106,9 @@ private: CORBA::Short time_displacement_factor_; // Time displacement factor in minutes. + TimeBase::InaccuracyT inaccuracy_; + // Inaccuracy in the time. + IORS server_; // Set of server Time Server IORs. diff --git a/TAO/orbsvcs/orbsvcs/Time/TAO_UTO.cpp b/TAO/orbsvcs/orbsvcs/Time/TAO_UTO.cpp index a6381267c65..ff9800e8f76 100644 --- a/TAO/orbsvcs/orbsvcs/Time/TAO_UTO.cpp +++ b/TAO/orbsvcs/orbsvcs/Time/TAO_UTO.cpp @@ -10,10 +10,18 @@ TAO_UTO::TAO_UTO (TimeBase::TimeT time, TimeBase::InaccuracyT inaccuracy, TimeBase::TdfT tdf) { + this->attr_utc_time_.time = time; - this->attr_utc_time_.inacchi = ACE_U64_TO_U32 (inaccuracy) / 2; - this->attr_utc_time_.inacclo = ACE_U64_TO_U32 (inaccuracy - (inaccuracy/2)); + + // Extract the lower 32 bits in the inacclo. + this->attr_utc_time_.inacclo = (CORBA::ULong) ACE_U64_TO_U32 (inaccuracy); + + // Extract the lower 16 bits of the remaining bits. 'And'ing with 0xFFFF + // is only a sanity check. + this->attr_utc_time_.inacchi = (CORBA::UShort) (inaccuracy >> 32) & (0xFFFF); + this->attr_utc_time_.tdf = tdf; + } // Destructor. @@ -35,7 +43,13 @@ TAO_UTO::time (CORBA::Environment &) TimeBase::InaccuracyT TAO_UTO::inaccuracy (CORBA::Environment &) { - return attr_utc_time_.inacclo + attr_utc_time_.inacchi; + // Construct the Inaccuracy from the + // inacchi and inacclo. + + TimeBase::InaccuracyT inaccuracy = attr_utc_time_.inacchi; + inaccuracy <<= 32; + inaccuracy |= attr_utc_time_.inacclo; + return inaccuracy; } // Get method for the readonly attribute tdf. diff --git a/TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp b/TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp index 532d6c0d2dc..4f259107403 100644 --- a/TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp +++ b/TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp @@ -30,6 +30,12 @@ Timer_Helper::handle_timeout (const ACE_Time_Value &, int no_of_servers = 0; CORBA::ULongLong sum = 0; + // The following are used to keep a track of the inaccuracy + // in synchronization. + + CORBA::ULongLong lowest_time = 0xFFFFFFFFFFFFFFFF; + CORBA::ULongLong highest_time = 0; + TAO_TRY { IORS::TYPE* value; @@ -71,10 +77,20 @@ Timer_Helper::handle_timeout (const ACE_Time_Value &, (UTO_server->utc_time ()).tdf)); #endif - // This is a remote call. - sum += (CORBA::ULongLong) UTO_server->time (TAO_TRY_ENV); + CORBA::ULongLong curr_server_time = UTO_server->time (TAO_TRY_ENV); + + sum += curr_server_time; ++no_of_servers; + + // Set the highest time to the largest time seen so far. + if (curr_server_time > highest_time) + highest_time = curr_server_time; + + // Set the lowest time to the smallest time seen so far. + if (curr_server_time < lowest_time) + lowest_time = curr_server_time; + } ACE_DEBUG ((LM_DEBUG, @@ -91,6 +107,12 @@ Timer_Helper::handle_timeout (const ACE_Time_Value &, ACE_OS::tzset(); clerk_->time_displacement_factor (ACE_OS::timezone () / 60); + + // Set the inaccuracy. + if (highest_time > lowest_time) + clerk_->inaccuracy (highest_time - lowest_time); + else + clerk_->inaccuracy (0); // Record the current time in a timestamp to know when global // updation of time was done. |