From: Karel Zak Date: Tue, 24 May 2016 09:10:10 +0000 (+0200) Subject: hwclock: use strtimeval_iso() X-Git-Tag: v2.29-rc1~232 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7c678f819b50117fec2461e02c18c181d13275f5;p=thirdparty%2Futil-linux.git hwclock: use strtimeval_iso() Signed-off-by: Karel Zak --- diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index 8241d81b9d..e98c2c00fa 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); } }