summaryrefslogtreecommitdiffstats
path: root/sys-utils/hwclock.c
diff options
context:
space:
mode:
authorJ William Piggott2017-10-22 02:40:58 +0200
committerJ William Piggott2017-11-17 01:43:16 +0100
commit01d971945c2677f8e766c329ae6aaafd66dd9f32 (patch)
tree349ff85cb9cfa7954f3748f8edfc2901e69522ed /sys-utils/hwclock.c
parentbash-completion: (umount) use findmnt, escape a space in paths (diff)
downloadkernel-qcow2-util-linux-01d971945c2677f8e766c329ae6aaafd66dd9f32.tar.gz
kernel-qcow2-util-linux-01d971945c2677f8e766c329ae6aaafd66dd9f32.tar.xz
kernel-qcow2-util-linux-01d971945c2677f8e766c329ae6aaafd66dd9f32.zip
hwclock: use reentrant time conversion functions
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Diffstat (limited to 'sys-utils/hwclock.c')
-rw-r--r--sys-utils/hwclock.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index c93a5fd65..8ff33474e 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 "
@@ -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)