-/* Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "knot/updates/apply.h"
#include "knot/zone/zone-dump.h"
#include "contrib/color.h"
+#include "contrib/time.h"
#include "libknot/libknot.h"
static int handle_soa(knot_rrset_t **soa, const knot_rrset_t *rrset)
char *buff = malloc(buflen);
knot_dump_style_t style = KNOT_DUMP_STYLE_DEFAULT;
+ style.now = knot_time();
style.color = COL_RED(color);
if (changeset->soa_from != NULL || !zone_contents_is_empty(changeset->remove)) {
-/* Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
// Set structure with parameters.
knot_dump_style_t style = KNOT_DUMP_STYLE_DEFAULT;
style.color = color;
+ style.now = knot_time();
dump_params_t params = {
.file = file,
.buf = buf,
#include "contrib/base64.h"
#include "contrib/color.h"
#include "contrib/ctype.h"
+#include "contrib/time.h"
#include "contrib/wire_ctx.h"
#define RRSET_DUMP_LIMIT (2 * 1024 * 1024)
.hide_crypto = false,
.ascii_to_idn = NULL,
.color = NULL,
+ .now = 0,
};
static void dump_string(rrset_dump_params_t *p, const char *str)
FILL_IN_INPUT(data)
time_t timestamp = ntohl(data);
+ if (sizeof(time_t) > 4) {
+ timestamp = knot_time_from_u32(timestamp, p->style->now);
+ }
if (p->style->human_timestamp) {
struct tm result;
-/* Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/*!< Optional color control sequence which is put before every output line.
* Not compatible with wrap. */
const char *color;
+ /*!< Time context for correct > 32 bit timestamp conversion. */
+ uint64_t now;
} knot_dump_style_t;
/*! \brief Default dump style. */
#include "contrib/sockaddr.h"
#include "contrib/string.h"
#include "contrib/strtonum.h"
+#include "contrib/time.h"
#include "contrib/ucw/lists.h"
#include "libdnssec/error.h"
#include "libdnssec/random.h"
query->notify = false;
query->flags = DEFAULT_FLAGS_DIG;
query->style = DEFAULT_STYLE_DIG;
+ query->style.style.now = knot_time();
query->idn = true;
query->nsid = false;
query->edns = -1;