mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-21 11:30:01 +00:00
Squash warnings
This commit is contained in:
1 parent
b7406357c5
commit
6149b619e7
3 files changed
+10
-7
No files matched your search
+4
-3
@@ -4,8 +4,8 @@
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
#define SNTP_TIME_OFFSET 2208988800UL // (1970 - 1900) in seconds
|
||||
#define SNTP_MAX_FRAC 4294967295.0 // 2 ** 32 - 1
|
||||
#define SNTP_TIME_OFFSET 2208988800U // (1970 - 1900) in seconds
|
||||
#define SNTP_MAX_FRAC 4294967295.0 // 2 ** 32 - 1
|
||||
|
||||
static int64_t gettimestamp(const uint32_t *data) {
|
||||
uint32_t sec = mg_ntohl(data[0]), frac = mg_ntohl(data[1]);
|
||||
@@ -62,9 +62,10 @@ void mg_sntp_request(struct mg_connection *c) {
|
||||
uint64_t now = mg_millis();
|
||||
uint8_t buf[48] = {0};
|
||||
uint32_t *t = (uint32_t *) &buf[40];
|
||||
double frac = ((double) (now % 1000)) / 1000.0;
|
||||
buf[0] = (0 << 6) | (4 << 3) | 3;
|
||||
t[0] = mg_htonl((uint32_t) (now / 1000) + SNTP_TIME_OFFSET);
|
||||
t[1] = mg_htonl((uint32_t) ((now % 1000) / 1000.0 * SNTP_MAX_FRAC));
|
||||
t[1] = mg_htonl((uint32_t) ((uint32_t) (frac * SNTP_MAX_FRAC)));
|
||||
mg_send(c, buf, sizeof(buf));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user