]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] add timezone to dig
authorEvan Hunt <each@isc.org>
Thu, 29 Nov 2012 17:07:28 +0000 (09:07 -0800)
committerEvan Hunt <each@isc.org>
Thu, 29 Nov 2012 17:07:28 +0000 (09:07 -0800)
3428. [cleanup] dig: Add timezone to date output. [RT #2269]

CHANGES
bin/dig/dig.c

diff --git a/CHANGES b/CHANGES
index 0544cca4b93bfd49cb7fae6e2dcecc43bfc27cbf..233e26c23fe914517c329c425a9b3c03dc07bdff 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+3428.  [cleanup]       dig: Add timezone to date output. [RT #2269]
+
 3427.  [bug]           dig +trace incorrectly displayed name server 
                        addresses instead of names. [RT #31641]
 
index 74263c9b0dd6b2e1924a23e9d2e252d7b898943b..66bed6a1d076f94df1eef10725b5294e51ed901b 100644 (file)
@@ -244,6 +244,8 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) {
        isc_uint64_t diff;
        isc_time_t now;
        time_t tnow;
+       struct tm tmnow;
+       char time_str[100];
        char fromtext[ISC_SOCKADDR_FORMATSIZE];
 
        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(";; SERVER: %s(%s)\n", fromtext, query->servname);
                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) {
                        printf(";; XFR size: %u records (messages %u, "
                               "bytes %" ISC_PRINT_QUADFORMAT "u)\n",
@@ -263,7 +268,6 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) {
                               query->byte_count);
                } else {
                        printf(";; MSG SIZE  rcvd: %u\n", bytes);
-
                }
                if (key != NULL) {
                        if (!validated)