summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys-utils/hwclock.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index c93a5fd65..e5f90a44e 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -375,9 +375,9 @@ set_hardware_clock(const struct hwclock_control *ctl, const time_t newtime)
*/
if (ctl->universal)
- new_broken_time = *gmtime(&newtime);
+ gmtime_r(&newtime, &new_broken_time);
else
- new_broken_time = *localtime(&newtime);
+ localtime_r(&newtime, &new_broken_time);
if (ctl->debug)
printf(_("Setting Hardware Clock to %.2d:%.2d:%.2d "
@@ -494,7 +494,7 @@ set_hardware_clock_exact(const struct hwclock_control *ctl,
/* The retarget is handled at the end of the loop. */
} else if (deltavstarget < 0) {
/* deltavstarget < 0 if current time < target time */
- if (ctl->debug >= 2)
+ if (ctl->debug >= 9)
printf(_("%ld.%06ld < %ld.%06ld (%.6f)\n"),
nowsystime.tv_sec,
nowsystime.tv_usec,
@@ -600,13 +600,13 @@ static int
set_system_clock(const struct hwclock_control *ctl,
const struct timeval newtime)
{
- struct tm *broken;
+ struct tm broken;
int minuteswest;
int rc = 0;
const struct timezone tz_utc = { 0 };
- broken = localtime(&newtime.tv_sec);
- minuteswest = -get_gmtoff(broken) / 60;
+ localtime_r(&newtime.tv_sec, &broken);
+ minuteswest = -get_gmtoff(&broken) / 60;
if (ctl->debug) {
if (ctl->hctosys && !ctl->universal)