summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2021-09-03 10:12:11 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2021-09-06 09:31:34 +0200
commit309785674b253526be5bb85d4d6b8a811a9ac088 (patch)
tree0954eda0f425c5c9945ff6efb9fdd5568909bb88
parent646c5d02a5db3e8c3677cdf8426a646dd118fd49 (diff)
datatype: time_print() ignores -T
Honor NFT_CTX_OUTPUT_NUMERIC_TIME. # nft list ruleset table ip x { set y { type ipv4_addr flags timeout elements = { 1.1.1.1 timeout 5m expires 1m49s40ms } } } # sudo nft -T list ruleset table ip x { set y { type ipv4_addr flags timeout elements = { 1.1.1.1 timeout 300s expires 108s } } } Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1561 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/datatype.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/datatype.c b/src/datatype.c
index 7267d608..b849f708 100644
--- a/src/datatype.c
+++ b/src/datatype.c
@@ -911,6 +911,11 @@ void time_print(uint64_t ms, struct output_ctx *octx)
{
uint64_t days, hours, minutes, seconds;
+ if (nft_output_seconds(octx)) {
+ nft_print(octx, "%" PRIu64 "s", ms / 1000);
+ return;
+ }
+
days = ms / 86400000;
ms %= 86400000;