Go to the documentation of this file.
29 #ifndef __BASE_TIME_HH__
30 #define __BASE_TIME_HH__
53 void _set(
bool monotonic);
100 void set(time_t _sec,
long _nsec) {
sec(_sec);
nsec(_nsec); }
125 double seconds = floor(new_time);
126 sec((time_t)seconds);
127 nsec((
long)((seconds - new_time) * 1e9));
135 nsec(tv.tv_usec * 1000);
150 operator double()
const
152 return (
double)
sec() + ((double)
nsec()) * 1
e-9;
158 operator timespec()
const {
return _time; }
159 operator timeval()
const
186 if (
_time.tv_nsec < 0) {
194 std::string
date(
const std::string &
format =
"")
const;
195 std::string
time()
const;
206 return l.sec() ==
r.sec() &&
l.nsec() ==
r.nsec();
212 return l.sec() !=
r.sec() ||
l.nsec() !=
r.nsec();
218 return (
l.sec() <
r.sec()) ||
219 (
l.sec() ==
r.sec() &&
l.nsec() <
r.nsec());
225 return (
l.sec() <
r.sec()) ||
226 (
l.sec() ==
r.sec() &&
l.nsec() <=
r.nsec());
232 return (
l.sec() >
r.sec()) ||
233 (
l.sec() ==
r.sec() &&
l.nsec() >
r.nsec());
239 return (
l.sec() >
r.sec()) ||
240 (
l.sec() ==
r.sec() &&
l.nsec() >=
r.nsec());
259 inline std::ostream &
268 #endif // __BASE_TIME_HH__
void set(time_t _sec, long _nsec)
Set the current time.
const Time & operator-=(const Time &other)
void setTick(Tick ticks)
Set the current time from a value measured in Ticks.
const Time & operator=(double new_time)
const Time & operator=(const timespec &ts)
Time operator-(const Time &l, const Time &r)
uint64_t Tick
Tick count type.
bool operator>=(const Time &l, const Time &r)
bool operator<(const Time &l, const Time &r)
std::string date(const std::string &format="") const
void sleep(const Time &time)
std::ostream & operator<<(std::ostream &out, const Time &time)
void _set(bool monotonic)
Internal time set function.
bool operator!=(const Time &l, const Time &r)
bool operator==(const Time &l, const Time &r)
void unserialize(const std::string &base, CheckpointIn &cp)
const Time & operator+=(const Time &other)
void setWallclock()
Use this to set the time to the actual current time.
Time(uint64_t sec, uint64_t nsec)
bool operator>(const Time &l, const Time &r)
time_t mkutctime(struct tm *time)
static const long NSEC_PER_MSEC
Tick getTick() const
Get the current time from a value measured in Ticks.
void serialize(const std::string &base, CheckpointOut &cp) const
const Time & operator=(const timeval &tv)
void setTimer()
Use this to set time for the purposes of time measurement (use a monotonic clock if it is available.
bool operator<=(const Time &l, const Time &r)
static const long NSEC_PER_USEC
std::ostream CheckpointOut
Time operator+(const Time &l, const Time &r)
Bitfield< 31, 29 > format
static const long NSEC_PER_SEC
void clear()
Clear the time.
const Time & operator=(const Time &other)
time_t sec() const
Accessors for getting and setting the current clock.
Generated on Wed Sep 30 2020 14:02:08 for gem5 by doxygen 1.8.17