summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/base/time.cc15
-rw-r--r--src/dev/sparc/dtod.cc13
2 files changed, 4 insertions, 24 deletions
diff --git a/src/base/time.cc b/src/base/time.cc
index dd9e72a09..c265c1c47 100644
--- a/src/base/time.cc
+++ b/src/base/time.cc
@@ -150,18 +150,7 @@ sleep(const Time &time)
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;
+ time_t local = mktime(time);
+ return mktime(gmtime(&local));
}
diff --git a/src/dev/sparc/dtod.cc b/src/dev/sparc/dtod.cc
index abbab2dee..0d57b1f83 100644
--- a/src/dev/sparc/dtod.cc
+++ b/src/dev/sparc/dtod.cc
@@ -53,17 +53,8 @@ DumbTOD::DumbTOD(const Params *p)
: BasicPioDevice(p, 0x08)
{
struct tm tm = p->time;
- char *tz;
-
- tz = getenv("TZ");
- setenv("TZ", "", 1);
- tzset();
- todTime = mktime(&tm);
- if (tz)
- setenv("TZ", tz, 1);
- else
- unsetenv("TZ");
- tzset();
+ time_t local = mktime(&tm);
+ todTime = mktime(gmtime(&local));
DPRINTFN("Real-time clock set to %s\n", asctime(&tm));
DPRINTFN("Real-time clock set to %d\n", todTime);