timegm() is a gnuism... replace with the code from the timegm() man page
--HG-- extra : convert_revision : f2b80a0b7768edc370e3f07c45cb3bb9a46450a9
This commit is contained in:
parent
716a2dc180
commit
d92f0d370b
|
@ -51,11 +51,21 @@ using namespace TheISA;
|
||||||
DumbTOD::DumbTOD(Params *p)
|
DumbTOD::DumbTOD(Params *p)
|
||||||
: BasicPioDevice(p)
|
: BasicPioDevice(p)
|
||||||
{
|
{
|
||||||
|
struct tm tm;
|
||||||
|
char *tz;
|
||||||
|
|
||||||
pioSize = 0x08;
|
pioSize = 0x08;
|
||||||
|
|
||||||
struct tm tm;
|
|
||||||
parseTime(p->init_time, &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 %s\n", asctime(&tm));
|
||||||
DPRINTFN("Real-time clock set to %d\n", todTime);
|
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");
|
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 §ion)
|
||||||
|
{
|
||||||
|
UNSERIALIZE_SCALAR(todTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BEGIN_DECLARE_SIM_OBJECT_PARAMS(DumbTOD)
|
BEGIN_DECLARE_SIM_OBJECT_PARAMS(DumbTOD)
|
||||||
|
|
||||||
Param<Addr> pio_addr;
|
Param<Addr> pio_addr;
|
||||||
|
|
|
@ -64,6 +64,21 @@ class DumbTOD : public BasicPioDevice
|
||||||
|
|
||||||
virtual Tick read(PacketPtr pkt);
|
virtual Tick read(PacketPtr pkt);
|
||||||
virtual Tick write(PacketPtr pkt);
|
virtual Tick write(PacketPtr pkt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize this object to the given output stream.
|
||||||
|
* @param os The stream to serialize to.
|
||||||
|
*/
|
||||||
|
virtual void serialize(std::ostream &os);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reconstruct the state of this object from a checkpoint.
|
||||||
|
* @param cp The checkpoint use.
|
||||||
|
* @param section The section name of this object
|
||||||
|
*/
|
||||||
|
virtual void unserialize(Checkpoint *cp, const std::string §ion);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __DEV_BADDEV_HH__
|
#endif // __DEV_BADDEV_HH__
|
||||||
|
|
Loading…
Reference in a new issue