summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorAli Saidi <Ali.Saidi@ARM.com>2012-03-01 17:26:31 -0600
committerAli Saidi <Ali.Saidi@ARM.com>2012-03-01 17:26:31 -0600
commit3876105bdb5589360c58389ffffff9786a93a2ff (patch)
tree1375b535d6c6419aeaf5568417407dd77b62fa90 /src/base
parent08187e3916fa615444ed61d739ac91e284735a66 (diff)
downloadgem5-3876105bdb5589360c58389ffffff9786a93a2ff.tar.xz
ARM: Add RTC device for ARM platforms.
This change implements a PL031 real time clock. --HG-- rename : src/dev/arm/timer_sp804.cc => src/dev/arm/rtc_pl031.cc rename : src/dev/arm/timer_sp804.hh => src/dev/arm/rtc_pl031.hh
Diffstat (limited to 'src/base')
-rw-r--r--src/base/time.cc21
-rw-r--r--src/base/time.hh2
2 files changed, 23 insertions, 0 deletions
diff --git a/src/base/time.cc b/src/base/time.cc
index 8ce2e2137..dd9e72a09 100644
--- a/src/base/time.cc
+++ b/src/base/time.cc
@@ -28,6 +28,8 @@
* Authors: Nathan Binkert
*/
+#include <cstdlib>
+#include <ctime>
#include <iostream>
#include <sstream>
@@ -144,3 +146,22 @@ sleep(const Time &time)
nanosleep(&ts, NULL);
#endif
}
+
+time_t
+mkutctime(struct tm *time)
+{
+ time_t ret;
+ char *tz;
+
+ tz = getenv("TZ");
+ setenv("TZ", "", 1);
+ tzset();
+ ret = mktime(time);
+ if (tz)
+ setenv("TZ", tz, 1);
+ else
+ unsetenv("TZ");
+ tzset();
+ return ret;
+}
+
diff --git a/src/base/time.hh b/src/base/time.hh
index f2107d78f..734a86fa9 100644
--- a/src/base/time.hh
+++ b/src/base/time.hh
@@ -268,4 +268,6 @@ operator<<(std::ostream &out, const Time &time)
return out;
}
+time_t mkutctime(struct tm *time);
+
#endif // __BASE_TIME_HH__