[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi/RTIA RTIA.cc RTIA_federate.cc TimeManagem...
From: |
certi-cvs |
Subject: |
[certi-cvs] certi/RTIA RTIA.cc RTIA_federate.cc TimeManagem... |
Date: |
Sun, 11 Oct 2009 17:12:06 +0000 |
CVSROOT: /sources/certi
Module name: certi
Changes by: Eric NOULARD <erk> 09/10/11 17:12:06
Modified files:
RTIA : RTIA.cc RTIA_federate.cc TimeManagement.hh
RTIA.hh
Log message:
Merge-in
patch #6943: Use Certi::Clock instead of architecture dependent code.
from Mathias.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA.cc?cvsroot=certi&r1=3.28&r2=3.29
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA_federate.cc?cvsroot=certi&r1=3.97&r2=3.98
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/TimeManagement.hh?cvsroot=certi&r1=3.19&r2=3.20
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA.hh?cvsroot=certi&r1=3.17&r2=3.18
Patches:
Index: RTIA.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA.cc,v
retrieving revision 3.28
retrieving revision 3.29
diff -u -b -r3.28 -r3.29
--- RTIA.cc 11 Oct 2009 11:22:55 -0000 3.28
+++ RTIA.cc 11 Oct 2009 17:12:06 -0000 3.29
@@ -18,12 +18,14 @@
// along with this program ; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// $Id: RTIA.cc,v 3.28 2009/10/11 11:22:55 erk Exp $
+// $Id: RTIA.cc,v 3.29 2009/10/11 17:12:06 erk Exp $
// ----------------------------------------------------------------------------
#include <config.h>
#include "RTIA.hh"
+#include "Clock.hh"
+
#include <assert.h>
#include <math.h>
#include <limits.h>
@@ -34,6 +36,9 @@
static pdCDebug D("RTIA", "(RTIA) ");
RTIA::RTIA(int RTIA_port, int RTIA_fd) {
+
+ clock = Clock::getBestClock();
+
// No SocketServer is passed to the RootObject (RTIA use case)
// socket server are passed to RootObject iff we are in RTIG.
rootObject = new RootObject(NULL);
@@ -92,6 +97,7 @@
delete queues ;
delete comm ;
delete rootObject ;
+ delete clock ;
} /* end of ~RTIA() */
// ----------------------------------------------------------------------------
@@ -194,4 +200,4 @@
}} // namespace certi/rtia
-// $Id: RTIA.cc,v 3.28 2009/10/11 11:22:55 erk Exp $
+// $Id: RTIA.cc,v 3.29 2009/10/11 17:12:06 erk Exp $
Index: RTIA_federate.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA_federate.cc,v
retrieving revision 3.97
retrieving revision 3.98
diff -u -b -r3.97 -r3.98
--- RTIA_federate.cc 21 Sep 2009 15:42:11 -0000 3.97
+++ RTIA_federate.cc 11 Oct 2009 17:12:06 -0000 3.98
@@ -23,14 +23,11 @@
#include <config.h>
#include "RTIA.hh"
+#include "Clock.hh"
#include "fed.hh"
#include "RoutingSpace.hh"
#include "XmlParser.hh"
#include <assert.h>
-#ifdef _WIN32
-#include <time.h>
-#include <sys/timeb.h>
-#endif
using std::string ;
using std::ifstream ;
@@ -42,22 +39,6 @@
static PrettyDebug G("GENDOC",__FILE__) ;
// ----------------------------------------------------------------------------
-static RTI::TickTime currentTickTime()
-{
- RTI::TickTime result;
-#ifdef _WIN32
- _timeb timev;
- _ftime(&timev);
- result = static_cast<RTI::TickTime>(timev.time + timev.millitm/1000);
-#else
- struct timeval timev;
- gettimeofday(&timev, NULL);
- result = timev.tv_sec + timev.tv_usec/1000000;
-#endif
- return result;
-}
-
-// ----------------------------------------------------------------------------
//! Verify that federate is not in saving or restoring state.
void
RTIA::saveAndRestoreStatus(Message::Type type)
@@ -1011,7 +992,8 @@
if (req->getMinTickTime() > 0.0)
{
tm->_tick_timeout = req->getMinTickTime();
- tm->_tick_stop_time = currentTickTime() + req->getMaxTickTime();
+ tm->_tick_max_tick = req->getMaxTickTime();
+ tm->_tick_clock_start = clock->getCurrentTicksValue();
tm->_tick_state = TimeManagement::TICK_BLOCKING;
}
else
@@ -1117,7 +1099,8 @@
* decide how to continue
*/
if (tm->_tick_result &&
- tm->_tick_multiple && currentTickTime() < tm->_tick_stop_time)
+ tm->_tick_multiple &&
+ 1e-9*clock->getDeltaNanoSecond(tm->_tick_clock_start) <
tm->_tick_max_tick)
tm->_tick_state = TimeManagement::TICK_CALLBACK;
else
tm->_tick_state = TimeManagement::TICK_RETURN;
Index: TimeManagement.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/TimeManagement.hh,v
retrieving revision 3.19
retrieving revision 3.20
diff -u -b -r3.19 -r3.20
--- TimeManagement.hh 8 Apr 2009 10:47:18 -0000 3.19
+++ TimeManagement.hh 11 Oct 2009 17:12:06 -0000 3.20
@@ -18,7 +18,7 @@
// along with this program ; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// $Id: TimeManagement.hh,v 3.19 2009/04/08 10:47:18 approx Exp $
+// $Id: TimeManagement.hh,v 3.20 2009/10/11 17:12:06 erk Exp $
// ----------------------------------------------------------------------------
#ifndef CERTI_RTIA_TIME_MANAGEMENT_HH
@@ -118,7 +118,8 @@
bool _tick_multiple; // process multiple callbacks
bool _tick_result; // tick() return value
RTI::TickTime _tick_timeout;
- RTI::TickTime _tick_stop_time;
+ RTI::TickTime _tick_max_tick;
+ uint64_t _tick_clock_start;
bool _asynchronous_delivery ;
private:
@@ -161,4 +162,4 @@
#endif // CERTI_RTIA_TIME_MANAGEMENT_HH
-// $Id: TimeManagement.hh,v 3.19 2009/04/08 10:47:18 approx Exp $
+// $Id: TimeManagement.hh,v 3.20 2009/10/11 17:12:06 erk Exp $
Index: RTIA.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA.hh,v
retrieving revision 3.17
retrieving revision 3.18
diff -u -b -r3.17 -r3.18
--- RTIA.hh 21 Sep 2009 15:42:11 -0000 3.17
+++ RTIA.hh 11 Oct 2009 17:12:06 -0000 3.18
@@ -18,7 +18,7 @@
// along with this program ; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// $Id: RTIA.hh,v 3.17 2009/09/21 15:42:11 erk Exp $
+// $Id: RTIA.hh,v 3.18 2009/10/11 17:12:06 erk Exp $
// ----------------------------------------------------------------------------
#ifndef _CERTI_RTIA_HH
@@ -35,6 +35,9 @@
#include "Statistics.hh"
namespace certi {
+
+class Clock;
+
namespace rtia {
/**
@@ -81,6 +84,7 @@
OwnershipManagement *owm ;
DeclarationManagement *dm ;
DataDistribution *ddm ;
+ Clock* clock ;
Statistics stat ;
void saveAndRestoreStatus(Message::Type type)
@@ -120,4 +124,4 @@
#endif // _CERTI_RTIA_HH
-// $Id: RTIA.hh,v 3.17 2009/09/21 15:42:11 erk Exp $
+// $Id: RTIA.hh,v 3.18 2009/10/11 17:12:06 erk Exp $
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] certi/RTIA RTIA.cc RTIA_federate.cc TimeManagem...,
certi-cvs <=