summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/meta.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/src/meta.c b/src/meta.c
index fdbeba26..bdd10269 100644
--- a/src/meta.c
+++ b/src/meta.c
@@ -388,27 +388,17 @@ static void date_type_print(const struct expr *expr, struct output_ctx *octx)
/* Convert from nanoseconds to seconds */
tstamp /= 1000000000L;
- if (!nft_output_seconds(octx)) {
- /* Obtain current tm, to add tm_gmtoff to the timestamp */
- cur_tm = localtime((time_t *) &tstamp);
+ /* Obtain current tm, to add tm_gmtoff to the timestamp */
+ cur_tm = localtime((time_t *) &tstamp);
- if (cur_tm)
- tstamp += cur_tm->tm_gmtoff;
-
- if ((tm = gmtime((time_t *) &tstamp)) != NULL &&
- strftime(timestr, sizeof(timestr) - 1, "%F %T", tm))
- nft_print(octx, "\"%s\"", timestr);
- else
- nft_print(octx, "Error converting timestamp to printed time");
-
- return;
- }
+ if (cur_tm)
+ tstamp += cur_tm->tm_gmtoff;
- /*
- * Do our own printing. The default print function will print in
- * nanoseconds, which is ugly.
- */
- nft_print(octx, "%" PRIu64, tstamp);
+ if ((tm = gmtime((time_t *) &tstamp)) != NULL &&
+ strftime(timestr, sizeof(timestr) - 1, "%F %T", tm))
+ nft_print(octx, "\"%s\"", timestr);
+ else
+ nft_print(octx, "Error converting timestamp to printed time");
}
static time_t parse_iso_date(const char *sym)
@@ -498,11 +488,6 @@ static void hour_type_print(const struct expr *expr, struct output_ctx *octx)
struct tm *cur_tm;
time_t ts;
- if (nft_output_seconds(octx)) {
- expr_basetype(expr)->print(expr, octx);
- return;
- }
-
/* Obtain current tm, so that we can add tm_gmtoff */
ts = time(NULL);
cur_tm = localtime(&ts);