summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys-utils/hwclock.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index c0ac67826..332f78cd2 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -814,14 +814,14 @@ static int set_system_clock_timezone(const bool universal, const bool testing)
minuteswest -= 60;
#endif
- gettimeofday(&tv, NULL);
- if (!universal)
- tv.tv_sec += minuteswest * 60;
-
if (debug) {
struct tm broken_time;
char ctime_now[200];
+ gettimeofday(&tv, NULL);
+ if (!universal)
+ tv.tv_sec += minuteswest * 60;
+
broken_time = *gmtime(&tv.tv_sec);
strftime(ctime_now, sizeof(ctime_now), "%Y/%m/%d %H:%M:%S",
&broken_time);
@@ -838,8 +838,9 @@ static int set_system_clock_timezone(const bool universal, const bool testing)
retcode = 0;
} else {
const struct timezone tz = { minuteswest, 0 };
+ const struct timeval *tv_null = NULL;
- rc = settimeofday(&tv, &tz);
+ rc = settimeofday(tv_null, &tz);
if (rc) {
if (errno == EPERM) {
warnx(_