diff options
author | Lisa Hsu <hsul@eecs.umich.edu> | 2004-05-11 01:15:18 -0400 |
---|---|---|
committer | Lisa Hsu <hsul@eecs.umich.edu> | 2004-05-11 01:15:18 -0400 |
commit | a5f90eba3bd2d96c6733a6ac9e8d03a9297fae6a (patch) | |
tree | 06662aecdd919aa0bafb0562fc646465dda5a901 /base/time.cc | |
parent | 3c7071a6be21fc0c87753758fc09ff28890edc99 (diff) | |
parent | 2cc4fd87eb643c81d37954cbf4a226e78ebd34bc (diff) | |
download | gem5-a5f90eba3bd2d96c6733a6ac9e8d03a9297fae6a.tar.xz |
first pass at merging m5 with linux
--HG--
extra : convert_revision : dfe23349b80ae3b34d3cb95c5734e01ef62f700e
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); |