diff options
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp | 23 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h | 9 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp | 19 |
3 files changed, 43 insertions, 8 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp b/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp index c4e3ffe3b0a..f957b80b77d 100644 --- a/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp +++ b/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp @@ -41,11 +41,11 @@ TAO_Time_Service_Clerk::universal_time (CORBA::Environment &TAO_IN_ENV) ACE_NEW_THROW_RETURN (uto, TAO_UTO (this->get_time (), 0, - 0), + this->time_displacement_factor ()), CORBA::NO_MEMORY (CORBA::COMPLETED_NO), CosTime::UTO::_nil ()); // Return the global time as a UTO. - + return uto->_this (); } @@ -126,3 +126,22 @@ TAO_Time_Service_Clerk::get_time (void) return time; } + +// Returns the time displacement factor in minutes. +// This is displacement from the GMT. +CORBA::Short +TAO_Time_Service_Clerk::time_displacement_factor (void) +{ + return time_displacement_factor_; +} + +// Sets the TDF. +void +TAO_Time_Service_Clerk::time_displacement_factor (CORBA::Short tdf) +{ + this->time_displacement_factor_ = tdf; +} + + + + diff --git a/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h b/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h index 0c7d9f7f766..976c0f576d6 100644 --- a/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h +++ b/TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h @@ -86,11 +86,20 @@ public: // 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. + CORBA::ULongLong time_; // Clerk's notion of time. private: + CORBA::Short time_displacement_factor_; + // Time displacement factor in minutes. + IORS server_; // Set of server Time Server IORs. diff --git a/TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp b/TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp index 5e25f40c2eb..532d6c0d2dc 100644 --- a/TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp +++ b/TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp @@ -3,6 +3,7 @@ #include "Timer_Helper.h" #include "TAO_Time_Service_Clerk.h" +#include "ace/OS.h" // Constructor. Timer_Helper::Timer_Helper (void) @@ -36,16 +37,15 @@ Timer_Helper::handle_timeout (const ACE_Time_Value &, server_iterator.next (value) != 0; server_iterator.advance ()) { - - printf("Making a remote Call\n"); + // This is a remote call. CosTime::UTO_var UTO_server = (*value)->universal_time (TAO_TRY_ENV); - + TAO_CHECK_ENV; - - #if defined (ACE_LACKS_LONGLONG_T) - + + #if defined (ACE_LACKS_LONGLONG_T) + ACE_DEBUG ((LM_DEBUG, "\nTime = %Q\nInaccuracy = %Q\nTimeDiff = %d\nstruct.time = %Q\n" "struct.inacclo = %d\nstruct.inacchi = %d\nstruct.Tdf = %d\n", @@ -85,6 +85,13 @@ Timer_Helper::handle_timeout (const ACE_Time_Value &, // servers. clerk_->time_ = sum / no_of_servers ; + // Set the Time Displacement Factor. The TZ environment variable is + // read to set the time zone. We convert the timezone value from seconds + // to minutes. + + ACE_OS::tzset(); + clerk_->time_displacement_factor (ACE_OS::timezone () / 60); + // Record the current time in a timestamp to know when global // updation of time was done. clerk_->update_timestamp_ = ACE_OS::gettimeofday ().sec () * 10000000 |