summaryrefslogtreecommitdiff
path: root/src/dev/sparc/dtod.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/dev/sparc/dtod.cc')
-rw-r--r--src/dev/sparc/dtod.cc27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/dev/sparc/dtod.cc b/src/dev/sparc/dtod.cc
index 50e158c12..42275c60a 100644
--- a/src/dev/sparc/dtod.cc
+++ b/src/dev/sparc/dtod.cc
@@ -51,11 +51,21 @@ using namespace TheISA;
DumbTOD::DumbTOD(Params *p)
: BasicPioDevice(p)
{
+ struct tm tm;
+ char *tz;
+
pioSize = 0x08;
- struct tm tm;
parseTime(p->init_time, &tm);
- todTime = timegm(&tm);
+ tz = getenv("TZ");
+ setenv("TZ", "", 1);
+ tzset();
+ todTime = mktime(&tm);
+ if (tz)
+ setenv("TZ", tz, 1);
+ else
+ unsetenv("TZ");
+ tzset();
DPRINTFN("Real-time clock set to %s\n", asctime(&tm));
DPRINTFN("Real-time clock set to %d\n", todTime);
@@ -82,6 +92,19 @@ DumbTOD::write(PacketPtr pkt)
panic("Dumb tod device doesn't support writes\n");
}
+void
+DumbTOD::serialize(std::ostream &os)
+{
+ SERIALIZE_SCALAR(todTime);
+}
+
+void
+DumbTOD::unserialize(Checkpoint *cp, const std::string &section)
+{
+ UNSERIALIZE_SCALAR(todTime);
+}
+
+
BEGIN_DECLARE_SIM_OBJECT_PARAMS(DumbTOD)
Param<Addr> pio_addr;