diff options
author | Sami Kerola | 2017-06-25 12:33:57 +0200 |
---|---|---|
committer | Sami Kerola | 2017-08-30 21:32:48 +0200 |
commit | 7d0b3acbb4c62ec80325f179d51065d935b83392 (patch) | |
tree | 5064b357c8d43348c8e2adc7ad0db4c5069a2fbb /sys-utils/rfkill.c | |
parent | rfkill: use libsmartcols output (diff) | |
download | kernel-qcow2-util-linux-7d0b3acbb4c62ec80325f179d51065d935b83392.tar.gz kernel-qcow2-util-linux-7d0b3acbb4c62ec80325f179d51065d935b83392.tar.xz kernel-qcow2-util-linux-7d0b3acbb4c62ec80325f179d51065d935b83392.zip |
rfkill: use human readable timestamps in event output
The event command appears to be something what primarily a developers will
to use when debugging.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/rfkill.c')
-rw-r--r-- | sys-utils/rfkill.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys-utils/rfkill.c b/sys-utils/rfkill.c index 04d4199f0..cf6e7d89c 100644 --- a/sys-utils/rfkill.c +++ b/sys-utils/rfkill.c @@ -31,6 +31,7 @@ #include "optutils.h" #include "pathnames.h" #include "strutils.h" +#include "timeutils.h" #include "widechar.h" #include "xalloc.h" @@ -135,6 +136,7 @@ static int rfkill_event(void) { struct rfkill_event event; struct timeval tv; + char date_buf[ISO_8601_BUFSIZ]; struct pollfd p; ssize_t len; int fd, n, ret = 0; @@ -172,11 +174,16 @@ static int rfkill_event(void) ret = 1; continue; } - gettimeofday(&tv, NULL); - printf("%ld.%06u: idx %u type %u op %u soft %u hard %u\n", - (long) tv.tv_sec, (unsigned int) tv.tv_usec, - event.idx, event.type, event.op, event.soft, event.hard); + strtimeval_iso(&tv, + ISO_8601_DATE | + ISO_8601_TIME | + ISO_8601_COMMAUSEC | + ISO_8601_TIMEZONE | + ISO_8601_SPACE, date_buf, sizeof(date_buf)); + printf("%s: idx %u type %u op %u soft %u hard %u\n", + date_buf, + event.idx, event.type, event.op, event.soft, event.hard); fflush(stdout); } |