netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft] datatype: fix output of time type
Date: Thu, 16 Jan 2014 22:14:47 +0100	[thread overview]
Message-ID: <1389906887-27919-1-git-send-email-pablo@netfilter.org> (raw)

Display output in seconds, which is what we get as input.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/datatype.c |   31 +------------------------------
 1 file changed, 1 insertion(+), 30 deletions(-)

diff --git a/src/datatype.c b/src/datatype.c
index 4594490..b8f6ca9 100644
--- a/src/datatype.c
+++ b/src/datatype.c
@@ -669,36 +669,7 @@ const struct datatype mark_type = {
 
 static void time_type_print(const struct expr *expr)
 {
-	uint64_t days, hours, minutes, seconds;
-	const char *delim = "";
-
-	seconds = mpz_get_uint64(expr->value);
-
-	days = seconds / 86400;
-	seconds %= 86400;
-
-	hours = seconds / 3600;
-	seconds %= 3600;
-
-	minutes = seconds / 60;
-	seconds %= 60;
-
-	if (days > 0) {
-		printf("%s%" PRIu64 " d", delim, days);
-		delim = " ";
-	}
-	if (hours > 0) {
-		printf("%s%" PRIu64 " h", delim, hours);
-		delim = " ";
-	}
-	if (minutes > 0) {
-		printf("%s%" PRIu64 " min", delim, minutes);
-		delim = " ";
-	}
-	if (seconds > 0) {
-		printf("%s%" PRIu64 " s", delim, seconds);
-		delim = " ";
-	}
+	printf("%"PRIu64"", mpz_get_uint64(expr->value));
 }
 
 const struct datatype time_type = {
-- 
1.7.10.4


                 reply	other threads:[~2014-01-16 21:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1389906887-27919-1-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).