summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvishal <vishal@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-03-14 03:53:24 +0000
committervishal <vishal@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-03-14 03:53:24 +0000
commit29dcb50adb843a3c5457b39cdaf1f48477ccb6f9 (patch)
tree1d2be9e65b34e25f3aebb275d7dfa659075847b3
parent9f6b50d20abf8be243b9486a2d9cccb64975591d (diff)
downloadATCD-29dcb50adb843a3c5457b39cdaf1f48477ccb6f9.tar.gz
*** empty log message ***
-rw-r--r--TAO/orbsvcs/Time_Service/README27
-rw-r--r--TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.cpp25
-rw-r--r--TAO/orbsvcs/orbsvcs/Time/TAO_Time_Service_Clerk.h15
-rw-r--r--TAO/orbsvcs/orbsvcs/Time/TAO_UTO.cpp20
-rw-r--r--TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp26
-rw-r--r--TAO/orbsvcs/tests/Time/Client_i.cpp18
6 files changed, 112 insertions, 19 deletions
diff --git a/TAO/orbsvcs/Time_Service/README b/TAO/orbsvcs/Time_Service/README
index fb8c275eef0..7bea0a6145a 100644
--- a/TAO/orbsvcs/Time_Service/README
+++ b/TAO/orbsvcs/Time_Service/README
@@ -8,7 +8,7 @@ client. The Time Service interface has been implemented as two servants:
the clerk and the server. Clients who wish to use the service talk to
clerks and the clerks in turn keep their time synchronized
globally. The clerks do this by talking to the servers running on
-different machines.
+different machines.
There needs to be atleast one time server running in the network. The Clerks
update their time periofically from the servers. The servers and clerks
@@ -69,3 +69,28 @@ Algorithms
Currently, updating the system time involves taking the average of all
the times received from the servers. This can be extended by using a
more elaborate distributed time synchronization algorithm.
+
+Version Updates : (10th March, 1999)
+-----------------
+
+The TAO Time Service has been updated to include the timezone information
+in the Universal Time Object. This object now also has an inaccuracy estimate
+in it. The inaccuracy is a measure of the skew in the synchronization of
+the clerks time. It is the difference between the highest and the lowest times
+from the servers that the clerk synchronizes its time with. The high-inaccuracy
+and the low-inaccuracy fields are also being calculated from the inaccuracy as
+follows :
+
+ Inaccuracy 64-bits
+ |------------------------------------|
+ | | inacchi | inacclo |
+ |------------------------------------|
+ 16-bits 16-bits 32-bits
+
+Thanks to Brian Dance <Brian_Dance@UECCS.co.uk> for reporting this.
+
+Future Versions of the service could include other measures of inaccuracy too,
+say the one based on precision in the time reported by servers. In this case
+the servers will have to supply an estimate of inaccuracy in their times.
+
+
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.
diff --git a/TAO/orbsvcs/tests/Time/Client_i.cpp b/TAO/orbsvcs/tests/Time/Client_i.cpp
index b431b4cebfe..39625ec11dd 100644
--- a/TAO/orbsvcs/tests/Time/Client_i.cpp
+++ b/TAO/orbsvcs/tests/Time/Client_i.cpp
@@ -102,10 +102,10 @@ Client_i::test_for_new_universal_time (void)
ACE_ASSERT (UTO_server->inaccuracy (TAO_TRY_ENV) == 9999);
ACE_ASSERT (UTO_server->tdf (TAO_TRY_ENV) == 99);
ACE_ASSERT ((UTO_server->utc_time (TAO_TRY_ENV)).time == 999999999);
- ACE_ASSERT ((UTO_server->utc_time (TAO_TRY_ENV)).inacchi == 9999 / 2);
- ACE_ASSERT ((UTO_server->utc_time (TAO_TRY_ENV)).inacclo == 9999 - 9999 / 2);
+ ACE_ASSERT ((UTO_server->utc_time (TAO_TRY_ENV)).inacchi == 0);
+ ACE_ASSERT ((UTO_server->utc_time (TAO_TRY_ENV)).inacclo == 9999);
ACE_ASSERT ((UTO_server->utc_time (TAO_TRY_ENV)).tdf == 99);
-
+
TAO_CHECK_ENV;
}
TAO_CATCHANY
@@ -133,15 +133,19 @@ Client_i::test_for_uto_from_utc (void)
{
CosTime::UTO_var UTO_server = this->clerk_->uto_from_utc (utc_struct,
TAO_TRY_ENV);
-
+
+ TimeBase::InaccuracyT inaccuracy = utc_struct.inacchi;
+ inaccuracy <<= 32;
+ inaccuracy |= utc_struct.inacclo;
+
ACE_ASSERT (UTO_server->time (TAO_TRY_ENV) == 999999999);
- ACE_ASSERT (UTO_server->inaccuracy (TAO_TRY_ENV) == 100);
+ ACE_ASSERT (UTO_server->inaccuracy (TAO_TRY_ENV) == inaccuracy);
ACE_ASSERT (UTO_server->tdf (TAO_TRY_ENV) == 99);
ACE_ASSERT ((UTO_server->utc_time (TAO_TRY_ENV)).time == 999999999);
ACE_ASSERT ((UTO_server->utc_time (TAO_TRY_ENV)).inacclo == 50);
ACE_ASSERT ((UTO_server->utc_time (TAO_TRY_ENV)).inacchi == 50);
ACE_ASSERT ((UTO_server->utc_time (TAO_TRY_ENV)).tdf == 99);
-
+
TAO_CHECK_ENV;
}
TAO_CATCHANY
@@ -178,7 +182,7 @@ Client_i::test_for_new_interval (void)
"[CLIENT] Process/Thread Id : (%P/%t) Test new_interval () fails.\n"));
}
TAO_ENDTRY;
-
+
return;
}