From 7c678f819b50117fec2461e02c18c181d13275f5 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 24 May 2016 11:10:10 +0200 Subject: hwclock: use strtimeval_iso() Signed-off-by: Karel Zak --- sys-utils/hwclock.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'sys-utils/hwclock.c') 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 @@ -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); } } -- cgit v1.2.3-55-g7522