2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-04 08:35:31 +00:00

[master] add timezone to dig

3428.	[cleanup]	dig: Add timezone to date output. [RT #2269]
This commit is contained in:
Evan Hunt
2012-11-29 09:07:28 -08:00
parent 6a321060c5
commit 706219e547
2 changed files with 8 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
3428. [cleanup] dig: Add timezone to date output. [RT #2269]
3427. [bug] dig +trace incorrectly displayed name server 3427. [bug] dig +trace incorrectly displayed name server
addresses instead of names. [RT #31641] addresses instead of names. [RT #31641]

View File

@@ -244,6 +244,8 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) {
isc_uint64_t diff; isc_uint64_t diff;
isc_time_t now; isc_time_t now;
time_t tnow; time_t tnow;
struct tm tmnow;
char time_str[100];
char fromtext[ISC_SOCKADDR_FORMATSIZE]; char fromtext[ISC_SOCKADDR_FORMATSIZE];
isc_sockaddr_format(from, fromtext, sizeof(fromtext)); isc_sockaddr_format(from, fromtext, sizeof(fromtext));
@@ -255,7 +257,10 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) {
printf(";; Query time: %ld msec\n", (long int)diff/1000); printf(";; Query time: %ld msec\n", (long int)diff/1000);
printf(";; SERVER: %s(%s)\n", fromtext, query->servname); printf(";; SERVER: %s(%s)\n", fromtext, query->servname);
time(&tnow); time(&tnow);
printf(";; WHEN: %s", ctime(&tnow)); tmnow = *localtime(&tnow);
if (strftime(time_str, sizeof(time_str),
"%a %b %d %T %Z %Y", &tmnow) > 0)
printf(";; WHEN: %s\n", time_str);
if (query->lookup->doing_xfr) { if (query->lookup->doing_xfr) {
printf(";; XFR size: %u records (messages %u, " printf(";; XFR size: %u records (messages %u, "
"bytes %" ISC_PRINT_QUADFORMAT "u)\n", "bytes %" ISC_PRINT_QUADFORMAT "u)\n",
@@ -263,7 +268,6 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) {
query->byte_count); query->byte_count);
} else { } else {
printf(";; MSG SIZE rcvd: %u\n", bytes); printf(";; MSG SIZE rcvd: %u\n", bytes);
} }
if (key != NULL) { if (key != NULL) {
if (!validated) if (!validated)