summaryrefslogtreecommitdiffstats
path: root/login-utils/lslogins.c
diff options
context:
space:
mode:
authorKarel Zak2016-05-24 11:08:10 +0200
committerKarel Zak2016-05-24 11:08:10 +0200
commit88134ee20863c060301508872aad966aff747933 (patch)
tree3f6273ebef0c36bc57f0450099891f00182e1c61 /login-utils/lslogins.c
parentlast: cleanup time formatting code (diff)
downloadkernel-qcow2-util-linux-88134ee20863c060301508872aad966aff747933.tar.gz
kernel-qcow2-util-linux-88134ee20863c060301508872aad966aff747933.tar.xz
kernel-qcow2-util-linux-88134ee20863c060301508872aad966aff747933.zip
lslogins: use strtm_iso()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils/lslogins.c')
-rw-r--r--login-utils/lslogins.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c
index 40a134308..58a81d164 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);