Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
920abd62
Commit
920abd62
authored
Apr 07, 2017
by
Deomid Ryabkov
Committed by
Cesanta Bot
Apr 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor SNTP fixes
PUBLISHED_FROM=03d04996f160f777339eec9528f2f187e1051ff9
parent
02b7399f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
mongoose.c
mongoose.c
+10
-9
No files found.
mongoose.c
View file @
920abd62
...
...
@@ -11986,7 +11986,7 @@ void mg_sntp_send_request(struct mg_connection *c) {
* but if local clock is absolutely broken (and doesn't work even
* as simple timer), it is better to disable it
*/
#ifndef MG_SN
M
P_NO_DELAY_CORRECTION
#ifndef MG_SN
T
P_NO_DELAY_CORRECTION
uint32_t
sec
;
sec
=
htonl
((
uint32_t
)(
mg_time
()
+
SNTP_TIME_OFFSET
));
memcpy
(
&
buf
[
40
],
&
sec
,
sizeof
(
sec
));
...
...
@@ -11995,7 +11995,7 @@ void mg_sntp_send_request(struct mg_connection *c) {
mg_send
(
c
,
buf
,
sizeof
(
buf
));
}
#ifndef MG_SN
M
P_NO_DELAY_CORRECTION
#ifndef MG_SN
T
P_NO_DELAY_CORRECTION
static
uint64_t
mg_calculate_delay
(
uint64_t
t1
,
uint64_t
t2
,
uint64_t
t3
)
{
/* roundloop delay = (T4 - T1) - (T3 - T2) */
uint64_t
d1
=
((
mg_time
()
+
SNTP_TIME_OFFSET
)
*
1000000
)
-
...
...
@@ -12010,12 +12010,10 @@ static uint64_t mg_calculate_delay(uint64_t t1, uint64_t t2, uint64_t t3) {
MG_INTERNAL
int
mg_sntp_parse_reply
(
const
char
*
buf
,
int
len
,
struct
mg_sntp_message
*
msg
)
{
uint8_t
hdr
;
uint64_t
orig_ts_T1
,
recv_ts_T2
,
trsm_ts_T3
,
delay
=
0
;
uint64_t
trsm_ts_T3
,
delay
=
0
;
int
mode
;
struct
timeval
tv
;
(
void
)
orig_ts_T1
;
(
void
)
recv_ts_T2
;
if
(
len
<
48
)
{
return
-
1
;
}
...
...
@@ -12039,10 +12037,13 @@ MG_INTERNAL int mg_sntp_parse_reply(const char *buf, int len,
mg_get_ntp_ts
(
&
buf
[
40
],
&
trsm_ts_T3
);
#ifndef MG_SNMP_NO_DELAY_CORRECTION
#ifndef MG_SNTP_NO_DELAY_CORRECTION
{
uint64_t
orig_ts_T1
,
recv_ts_T2
;
mg_get_ntp_ts
(
&
buf
[
24
],
&
orig_ts_T1
);
mg_get_ntp_ts
(
&
buf
[
32
],
&
recv_ts_T2
);
delay
=
mg_calculate_delay
(
orig_ts_T1
,
recv_ts_T2
,
trsm_ts_T3
);
}
#endif
mg_ntp_to_tv
(
trsm_ts_T3
,
&
tv
);
...
...
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