static isc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE,
ip6_int = ISC_FALSE, plusquest = ISC_FALSE, pluscomm = ISC_FALSE,
multiline = ISC_FALSE, nottl = ISC_FALSE, noclass = ISC_FALSE,
- onesoa = ISC_FALSE, rrcomments = ISC_FALSE;
+ onesoa = ISC_FALSE, rrcomments = ISC_FALSE, use_usec = ISC_FALSE;
static isc_uint32_t splitwidth = 0xffffffff;
/*% opcode text */
" -q name (specify query name)\n"
" -t type (specify query type)\n"
" -c class (specify query class)\n"
+" -u (display times in usec instead of msec)\n"
" -k keyfile (specify tsig key file)\n"
" -y [hmac:]name:key (specify named base64 tsig key)\n"
" -4 (use IPv4 query transport only)\n"
if (query->lookup->stats && !short_form) {
diff = isc_time_microdiff(&now, &query->time_sent);
- printf(";; Query time: %ld msec\n", (long int)diff/1000);
+ if (use_usec)
+ printf(";; Query time: %ld usec\n", (long) diff);
+ else
+ printf(";; Query time: %ld msec\n", (long) diff / 1000);
printf(";; SERVER: %s(%s)\n", fromtext, query->servname);
time(&tnow);
tmnow = *localtime(&tnow);
puts("");
} else if (query->lookup->identify && !short_form) {
diff = isc_time_microdiff(&now, &query->time_sent);
- printf(";; Received %" ISC_PRINT_QUADFORMAT "u bytes "
- "from %s(%s) in %d ms\n\n",
- query->lookup->doing_xfr ?
- query->byte_count : (isc_uint64_t)bytes,
- fromtext, query->userarg,
- (int)diff/1000);
+ if (use_usec)
+ printf(";; Received %" ISC_PRINT_QUADFORMAT "u bytes "
+ "from %s(%s) in %ld us\n\n",
+ query->lookup->doing_xfr
+ ? query->byte_count
+ : (isc_uint64_t)bytes,
+ fromtext, query->userarg, (long) diff);
+ else
+ printf(";; Received %" ISC_PRINT_QUADFORMAT "u bytes "
+ "from %s(%s) in %ld ms\n\n",
+ query->lookup->doing_xfr
+ ? query->byte_count
+ : (isc_uint64_t)bytes,
+ fromtext, query->userarg, (long) diff / 1000);
}
}
diff = isc_time_microdiff(&now, &query->time_sent);
ADD_STRING(buf, " from server ");
ADD_STRING(buf, query->servname);
- snprintf(store, 19, " in %d ms.", (int)diff/1000);
+ if (use_usec)
+ snprintf(store, 19, " in %ld us.", (long) diff);
+ else
+ snprintf(store, 19, " in %ld ms.", (long) diff / 1000);
ADD_STRING(buf, store);
}
ADD_STRING(buf, "\n");
/*%
* #ISC_TRUE returned if value was used
*/
-static const char *single_dash_opts = "46dhimnv";
+static const char *single_dash_opts = "46dhimnuv";
static const char *dash_opts = "46bcdfhikmnptvyx";
static isc_boolean_t
dash_option(char *option, char *next, dig_lookup_t **lookup,
while (strpbrk(option, single_dash_opts) == &option[0]) {
/*
- * Since the -[46dhimnv] options do not take an argument,
+ * Since the -[46dhimnuv] options do not take an argument,
* account for them (in any number and/or combination)
* if they appear as the first character(s) of a q-opt.
*/
case 'n':
/* deprecated */
break;
+ case 'u':
+ use_usec = ISC_TRUE;
+ break;
case 'v':
version();
exit(0);