TimeSync: Use the new setTick and getTick functions.
authorGabe Black <gblack@eecs.umich.edu>
Thu, 20 Jan 2011 00:22:23 +0000 (16:22 -0800)
committerGabe Black <gblack@eecs.umich.edu>
Thu, 20 Jan 2011 00:22:23 +0000 (16:22 -0800)
src/sim/root.cc

index d44c72f4dbc07cef4a447024ec39d25819d0c2d5..1dc9b605865b4809f09271f3b19cbfb8ee73dda5 100644 (file)
@@ -32,7 +32,6 @@
  */
 
 #include "base/misc.hh"
-#include "sim/core.hh"
 #include "sim/root.hh"
 
 Root *Root::_root = NULL;
@@ -87,8 +86,7 @@ Root::timeSyncPeriod(Time newPeriod)
 {
     bool en = timeSyncEnabled();
     _period = newPeriod;
-    _periodTick = _period.nsec() * SimClock::Int::ns +
-                  _period.sec() * SimClock::Int::s;
+    _periodTick = _period.getTick();
     timeSyncEnable(en);
 }
 
@@ -104,11 +102,8 @@ Root::timeSyncSpinThreshold(Time newThreshold)
 Root::Root(RootParams *p) : SimObject(p), _enabled(false),
     _periodTick(p->time_sync_period), syncEvent(this)
 {
-    uint64_t nsecs = p->time_sync_period / SimClock::Int::ns;
-    _period.set(nsecs / Time::NSEC_PER_SEC, nsecs % Time::NSEC_PER_SEC);
-    nsecs = p->time_sync_spin_threshold / SimClock::Int::ns;
-    _spinThreshold.set(nsecs / Time::NSEC_PER_SEC,
-            nsecs % Time::NSEC_PER_SEC);
+    _period.setTick(p->time_sync_period);
+    _spinThreshold.setTick(p->time_sync_spin_threshold);
 
     assert(_root == NULL);
     _root = this;