diff options
author | Nathan Binkert <binkertn@umich.edu> | 2004-03-24 04:35:48 -0500 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2004-03-24 04:35:48 -0500 |
commit | 2484aeaee7004f7b8c128cf58e08c9b676fc08e6 (patch) | |
tree | 4e3333f47a344535c23cc14627cccf207d2e25c4 /base/time.cc | |
parent | 832a0917cf28d09520c1d2ac60921c4e034f7c26 (diff) | |
download | gem5-2484aeaee7004f7b8c128cf58e08c9b676fc08e6.tar.xz |
Minor changes to Time
base/time.cc:
base/time.hh:
Don't set the current time in the constructor. Use a flag and
make the default to not set the time.
Change reset() to set(). Dunno. Just seems right.
--HG--
extra : convert_revision : 5a3b09ed30376d4863b45b2bae551ba1c3aff8e1
Diffstat (limited to 'base/time.cc')
-rw-r--r-- | base/time.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/base/time.cc b/base/time.cc index d2e8f60a5..9a484a883 100644 --- a/base/time.cc +++ b/base/time.cc @@ -47,10 +47,11 @@ convert(const timeval &tv) return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0; } -Time::Time() +Time::Time(bool set_now) { time = new _timeval; - ::gettimeofday(&time->tv, NULL); + if (set_now) + set(); } Time::Time(const timeval &val) @@ -77,15 +78,15 @@ Time::get() const } void -Time::set(const timeval &tv) +Time::set() { - memcpy(&time->tv, &tv, sizeof(timeval)); + ::gettimeofday(&time->tv, NULL); } void -Time::reset() +Time::set(const timeval &tv) { - ::gettimeofday(&time->tv, NULL); + memcpy(&time->tv, &tv, sizeof(timeval)); } double @@ -127,4 +128,4 @@ operator-(const Time &l, const Time &r) return tv; } -const Time Time::start; +const Time Time::start(true); |