Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PPSi
Commits
f0fe7442
Commit
f0fe7442
authored
Oct 22, 2016
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
time: fix tools (i.e. ptpdump)
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
35eef679
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
dump-funcs.c
tools/dump-funcs.c
+5
-4
dump-main.c
tools/dump-main.c
+9
-9
No files found.
tools/dump-funcs.c
View file @
f0fe7442
...
...
@@ -45,11 +45,12 @@ static void dump_time(char *prefix, const struct pp_time *t)
is_incorrect
(
t
)
?
" invalid"
:
""
);
}
#else
static
void
dump_time
(
char
*
prefix
,
struct
TimeInternal
*
ti
)
static
void
dump_time
(
char
*
prefix
,
const
struct
pp_time
*
t
)
{
printf
(
"%sTIME: (%li - 0x%lx) %li.%06li%s
\n
"
,
prefix
,
(
long
)
ti
->
seconds
,
(
long
)
ti
->
seconds
,
(
long
)
ti
->
seconds
,
(
long
)
ti
->
nanoseconds
,
!
ti
->
correct
?
" invalid"
:
""
);
printf
(
"%sTIME: (%li - 0x%lx) %li.%06li%s
\n
"
,
prefix
,
(
long
)
t
->
secs
,
(
long
)
t
->
secs
,
(
long
)
t
->
secs
,
(
long
)(
t
->
scaled_nsecs
>>
16
)
/
1000
,
is_incorrect
(
t
)
?
" invalid"
:
""
);
}
#endif
...
...
tools/dump-main.c
View file @
f0fe7442
...
...
@@ -33,16 +33,16 @@
#define ETH_P_1588 0x88F7
#endif
void
print_spaces
(
struct
TimeInternal
*
ti
)
void
print_spaces
(
struct
pp_time
*
ti
)
{
static
struct
TimeInternal
prev_ti
;
static
struct
pp_time
prev_ti
;
int
i
,
diffms
;
if
(
prev_ti
.
sec
ond
s
)
{
if
(
prev_ti
.
secs
)
{
diffms
=
(
ti
->
sec
onds
-
prev_ti
.
second
s
)
*
1000
+
(
ti
->
nanoseconds
/
1000
/
1000
)
-
(
prev_ti
.
nanoseconds
/
1000
/
1000
);
diffms
=
(
ti
->
sec
s
-
prev_ti
.
sec
s
)
*
1000
+
(
(
ti
->
scaled_nsecs
>>
16
)
/
1000
/
1000
)
-
(
(
prev_ti
.
scaled_nsecs
)
/
1000
/
1000
);
/* empty lines, one every .25 seconds, at most 10 of them */
for
(
i
=
250
;
i
<
2500
&&
i
<
diffms
;
i
+=
250
)
printf
(
"
\n
"
);
...
...
@@ -117,7 +117,7 @@ int main(int argc, char **argv)
struct
pp_vlanhdr
*
vhdr
;
struct
iphdr
*
ip
;
unsigned
char
buf
[
1500
];
struct
TimeInternal
ti
;
struct
pp_time
ti
;
struct
timeval
tv
;
struct
msghdr
msg
;
struct
iovec
entry
;
...
...
@@ -146,8 +146,8 @@ int main(int argc, char **argv)
/* Get the receive time, copy it to TimeInternal */
gettimeofday
(
&
tv
,
NULL
);
ti
.
sec
ond
s
=
tv
.
tv_sec
;
ti
.
nanoseconds
=
tv
.
tv_usec
*
1000
;
ti
.
secs
=
tv
.
tv_sec
;
ti
.
scaled_nsecs
=
(
tv
.
tv_usec
*
1000LL
)
<<
16
;
if
(
len
>
sizeof
(
buf
))
len
=
sizeof
(
buf
);
...
...
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