Merge zizzer:/bk/newmem

into  zower.eecs.umich.edu:/eecshome/m5/newmem

--HG--
extra : convert_revision : 2398e48722dd71ddf270e93bd7b387078fb30e6b
This commit is contained in:
Gabe Black
2007-01-28 14:46:56 -05:00
14 changed files with 88 additions and 81 deletions

View File

@@ -38,6 +38,8 @@
#define __HOST_HH__
#include <inttypes.h>
#include <limits>
/** uint64_t constant */
#define ULL(N) ((uint64_t)N##ULL)
@@ -56,7 +58,7 @@ typedef int64_t Counter;
*/
typedef int64_t Tick;
const Tick MaxTick = (1LL << 63) - 1;
const Tick MaxTick = std::numeric_limits<Tick>::max();
/**
* Address type

View File

@@ -777,3 +777,27 @@ ParamContext::describeAllContexts(ostream &os)
os << endl;
}
}
void
parseTime(const std::vector<int> &time, struct tm *tm)
{
memset(tm, 0, sizeof(struct tm));
// UNIX is years since 1900
tm->tm_year = time[0] - 1900;
// Python starts at 1, UNIX starts at 0
tm->tm_mon = time[1] - 1;
tm->tm_mday = time[2];
tm->tm_hour = time[3];
tm->tm_min = time[4];
tm->tm_sec = time[5];
// Python has 0 as Monday, UNIX is 0 as sunday
tm->tm_wday = time[6] + 1;
if (tm->tm_wday > 6)
tm->tm_wday -= 7;
// Python starts at 1, Unix starts at 0
tm->tm_yday = time[7] - 1;
}

View File

@@ -781,4 +781,5 @@ SimObjectVectorParam<OBJ_CLASS *>::showType(std::ostream &os) const \
template <class T> bool parseParam(const std::string &str, T &data);
template <class T> void showParam(std::ostream &os, const T &data);
void parseTime(const std::vector<int> &time, struct tm *tm);
#endif // _SIM_PARAM_HH_