summaryrefslogtreecommitdiffstats
path: root/sys-utils/hwclock.c
diff options
context:
space:
mode:
authorKarel Zak2016-05-24 11:10:10 +0200
committerKarel Zak2016-05-24 11:10:10 +0200
commit7c678f819b50117fec2461e02c18c181d13275f5 (patch)
tree75692190ce952a2383209b5a701af32f9ae14b75 /sys-utils/hwclock.c
parentdmesg: use strtimeval_iso() (diff)
downloadkernel-qcow2-util-linux-7c678f819b50117fec2461e02c18c181d13275f5.tar.gz
kernel-qcow2-util-linux-7c678f819b50117fec2461e02c18c181d13275f5.tar.xz
kernel-qcow2-util-linux-7c678f819b50117fec2461e02c18c181d13275f5.zip
hwclock: use strtimeval_iso()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/hwclock.c')
-rw-r--r--sys-utils/hwclock.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index 8241d81b9..e98c2c00f 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -80,6 +80,7 @@
#include "pathnames.h"
#include "strutils.h"
#include "hwclock.h"
+#include "timeutils.h"
#ifdef HAVE_LIBAUDIT
#include <libaudit.h>
@@ -687,15 +688,12 @@ display_time(const bool hclock_valid, struct timeval hwctime)
"either invalid (e.g. 50th day of month) or beyond the range "
"we can handle (e.g. Year 2095)."));
else {
- struct tm lt;
- int zhour, zmin;
-
- lt = *localtime(&hwctime.tv_sec);
- zhour = - timezone / 60 / 60;
- zmin = labs(timezone / 60 % 60);
- printf(_("%4d-%.2d-%.2d %02d:%02d:%02d.%06ld%+02d:%02d\n"),
- lt.tm_year + 1900, lt.tm_mon + 1, lt.tm_mday, lt.tm_hour,
- lt.tm_min, lt.tm_sec, (long)hwctime.tv_usec, zhour, zmin);
+ char buf[ISO_8601_BUFSIZ];
+
+ strtimeval_iso(&hwctime, ISO_8601_DATE|ISO_8601_TIME|ISO_8601_DOTUSEC|
+ ISO_8601_TIMEZONE|ISO_8601_SPACE,
+ buf, sizeof(buf));
+ printf("%s\n", buf);
}
}