#include "base/time.hh"
#include "config/use_posix_clock.hh"
+#include "sim/core.hh"
using namespace std;
#endif
}
+void
+Time::setTick(Tick ticks)
+{
+ uint64_t nsecs = ticks / SimClock::Int::ns;
+ set(nsecs / NSEC_PER_SEC, nsecs % NSEC_PER_SEC);
+}
+
+Tick
+Time::getTick() const
+{
+ return (nsec() + sec() * NSEC_PER_SEC) * SimClock::Int::ns;
+}
+
string
Time::date(const string &format) const
{
#include <iosfwd>
#include <string>
+#include "base/types.hh"
+
class Time
{
protected:
*/
void set(time_t _sec, long _nsec) { sec(_sec); nsec(_nsec); }
+ /**
+ * Set the current time from a value measured in Ticks
+ * @param ticks Number of ticks to convert into a time.
+ */
+ void setTick(Tick ticks);
+
+ /**
+ * Get the current time from a value measured in Ticks
+ * @return Time value measured in Ticks.
+ */
+ Tick getTick() const;
+
const Time &
operator=(const Time &other)
{