From: Karel Zak Date: Tue, 24 May 2016 09:08:10 +0000 (+0200) Subject: lslogins: use strtm_iso() X-Git-Tag: v2.29-rc1~234 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=88134ee20863c060301508872aad966aff747933;p=thirdparty%2Futil-linux.git lslogins: use strtm_iso() Signed-off-by: Karel Zak --- diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c index 40a1343088..58a81d1642 100644 --- a/login-utils/lslogins.c +++ b/login-utils/lslogins.c @@ -56,6 +56,7 @@ #include "pathnames.h" #include "logindefs.h" #include "procutils.h" +#include "timeutils.h" /* * column description @@ -346,7 +347,10 @@ static char *make_time(int mode, time_t time) strftime(buf, sizeof(buf), "%Y-%b%d", &tm); break; case TIME_ISO: - strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S%z", &tm); + if (strtm_iso(&tm, ISO_8601_DATE|ISO_8601_TIME|ISO_8601_TIMEZONE, + buf, sizeof(buf)) != 0) + err(EXIT_FAILURE, _("failed to formate ISO time")); + s = buf; break; case TIME_ISO_SHORT: strftime(buf, sizeof(buf), "%Y-%m-%d", &tm);