Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
tsn-measures
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
tsn-measures
Commits
7ab20c28
Commit
7ab20c28
authored
May 26, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take into account tai offset when comparing txtime and timestamp
parent
33329637
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
packet-exchange/src/send_packet.c
packet-exchange/src/send_packet.c
+10
-2
No files found.
packet-exchange/src/send_packet.c
View file @
7ab20c28
...
...
@@ -40,7 +40,7 @@
#define SERVER_PORT_INT 50000
#define CLOCK_ID CLOCK_TAI
#define MESSAGE ((uint32_t)0x00FACADE)
#define NSEC_PER_SEC
1000000000
#define NSEC_PER_SEC
((uint64_t)1000000000)
static
void
print_timestamps
(
struct
msghdr
*
msg
,
uint64_t
txtime
);
static
void
process_timestamps
(
uint64_t
txtime
);
...
...
@@ -51,6 +51,8 @@ static unsigned char tx_buffer[1024] = "Hi";
static
size_t
tx_buffer_len
=
sizeof
(
tx_buffer
);
static
int
fd
;
static
int64_t
tai_offset
;
static
int
so_timestamping_flags
=
SOF_TIMESTAMPING_TX_SOFTWARE
|
SOF_TIMESTAMPING_SOFTWARE
;
...
...
@@ -74,6 +76,12 @@ void init_udp_etf(int use_etf, int use_timestamps, int packet_priority,
char
*
network_if
)
{
int
index
;
struct
timespec
ts_mon
;
struct
timespec
ts_tai
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
ts_mon
);
clock_gettime
(
CLOCK_TAI
,
&
ts_tai
);
tai_offset
=
(
ts_mon
.
tv_sec
-
ts_tai
.
tv_sec
)
*
NSEC_PER_SEC
+
(
ts_mon
.
tv_nsec
-
ts_tai
.
tv_nsec
);
so_priority
=
packet_priority
;
fd
=
socket
(
PF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
...
...
@@ -211,7 +219,7 @@ static void print_timestamps(struct msghdr *msg, uint64_t txtime) {
stamp
->
tv_sec
*
NSEC_PER_SEC
+
stamp
->
tv_nsec
;
printf
(
"SO_TIMESTAMPING "
);
printf
(
"SW %"
PRIu64
" - %"
PRIu64
" (%"
PRIi64
") "
,
timestamp_ns
,
txtime
,
((
int64_t
)
timestamp_ns
)
-
txtime
);
txtime
,
((
int64_t
)
timestamp_ns
)
-
txtime
-
tai_offset
);
break
;
}
default:
...
...
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