Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Håvard Eidnes
BIND
Commits
3fe7fa3d
Commit
3fe7fa3d
authored
Sep 29, 2020
by
Mark Andrews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Output timestamps in yaml to the microsecond if -u is specified.
parent
519b0706
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
4 deletions
+48
-4
bin/dig/dig.c
bin/dig/dig.c
+14
-4
bin/tests/system/digdelv/tests.sh
bin/tests/system/digdelv/tests.sh
+34
-0
No files found.
bin/dig/dig.c
View file @
3fe7fa3d
...
...
@@ -675,15 +675,25 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
if
(
!
isc_time_isepoch
(
&
query
->
time_sent
))
{
char
tbuf
[
100
];
isc_time_formatISO8601ms
(
&
query
->
time_sent
,
tbuf
,
sizeof
(
tbuf
));
if
(
query
->
lookup
->
use_usec
)
{
isc_time_formatISO8601us
(
&
query
->
time_sent
,
tbuf
,
sizeof
(
tbuf
));
}
else
{
isc_time_formatISO8601ms
(
&
query
->
time_sent
,
tbuf
,
sizeof
(
tbuf
));
}
printf
(
" query_time: !!timestamp %s
\n
"
,
tbuf
);
}
if
(
!
isquery
&&
!
isc_time_isepoch
(
&
query
->
time_recv
))
{
char
tbuf
[
100
];
isc_time_formatISO8601ms
(
&
query
->
time_recv
,
tbuf
,
sizeof
(
tbuf
));
if
(
query
->
lookup
->
use_usec
)
{
isc_time_formatISO8601us
(
&
query
->
time_recv
,
tbuf
,
sizeof
(
tbuf
));
}
else
{
isc_time_formatISO8601ms
(
&
query
->
time_recv
,
tbuf
,
sizeof
(
tbuf
));
}
printf
(
" response_time: !!timestamp %s
\n
"
,
tbuf
);
}
...
...
bin/tests/system/digdelv/tests.sh
View file @
3fe7fa3d
...
...
@@ -963,6 +963,40 @@ if [ -x "$DIG" ] ; then
if
[
$ret
-ne
0
]
;
then
echo_i
"failed"
;
fi
status
=
$((
status+ret
))
n
=
$((
n+1
))
echo_i
"check that dig without -u displays 'Query time' in millseconds (
$n
)"
ret
=
0
dig_with_opts @10.53.0.3 a.example
>
dig.out.test
$n
2>&1
||
ret
=
1
grep
';; Query time: [0-9][0-9]* msec'
dig.out.test
$n
>
/dev/null
||
ret
=
1
if
[
$ret
-ne
0
]
;
then
echo_i
"failed"
;
fi
status
=
$((
status+ret
))
n
=
$((
n+1
))
echo_i
"check that dig -u displays 'Query time' in microseconds (
$n
)"
ret
=
0
dig_with_opts
-u
@10.53.0.3 a.example
>
dig.out.test
$n
2>&1
||
ret
=
1
grep
';; Query time: [0-9][0-9]* usec'
dig.out.test
$n
>
/dev/null
||
ret
=
1
if
[
$ret
-ne
0
]
;
then
echo_i
"failed"
;
fi
status
=
$((
status+ret
))
n
=
$((
n+1
))
echo_i
"check that dig +yaml without -u displays timestamps in milliseconds (
$n
)"
ret
=
0
dig_with_opts +yaml @10.53.0.3 a.example
>
dig.out.test
$n
2>&1
||
ret
=
1
grep
'query_time: !!timestamp ....-..-..T..:..:..\....Z'
dig.out.test
$n
>
/dev/null
||
ret
=
1
grep
'response_time: !!timestamp ....-..-..T..:..:..\....Z'
dig.out.test
$n
>
/dev/null
||
ret
=
1
if
[
$ret
-ne
0
]
;
then
echo_i
"failed"
;
fi
status
=
$((
status+ret
))
n
=
$((
n+1
))
echo_i
"check that dig -u +yaml displays timestamps in microseconds (
$n
)"
ret
=
0
dig_with_opts
-u
+yaml @10.53.0.3 a.example
>
dig.out.test
$n
2>&1
||
ret
=
1
grep
'query_time: !!timestamp ....-..-..T..:..:..\.......Z'
dig.out.test
$n
>
/dev/null
||
ret
=
1
grep
'response_time: !!timestamp ....-..-..T..:..:..\.......Z'
dig.out.test
$n
>
/dev/null
||
ret
=
1
if
[
$ret
-ne
0
]
;
then
echo_i
"failed"
;
fi
status
=
$((
status+ret
))
else
echo_i
"
$DIG
is needed, so skipping these dig tests"
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment