Skip to content

Commit 8f8dd9c

Browse files
Fixing warnings
1 parent ae744e3 commit 8f8dd9c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

print-geonet.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
#define CYCLE_SIZE ((uint64_t)1 << 32)
5858

5959
#define IMPLEMENTED_GN_HEADER_TYPES_NUM 2
60-
const u_int implemented_gn_header_types[IMPLEMENTED_GN_HEADER_TYPES_NUM] = {
60+
static const u_int implemented_gn_header_types[IMPLEMENTED_GN_HEADER_TYPES_NUM] = {
6161
HT_BEACON,
6262
HT_TSB
6363
};
@@ -324,30 +324,24 @@ static const char* process_gn_addr(netdissect_options *ndo, u_int64_t gn_addr){
324324

325325

326326
static const char* process_tst(uint32_t tst) {
327-
static char buffer[32];
327+
static char buffer[80];
328328

329-
// Get current UTC time in milliseconds
330329
struct timespec now;
331330
clock_gettime(CLOCK_REALTIME, &now);
332331
uint64_t ref_utc_ms = (uint64_t)now.tv_sec * 1000 + now.tv_nsec / 1000000;
333332

334-
// Compute number of cycles
335333
uint64_t adjusted_timestamp = ref_utc_ms - ITS_EPOCH_MS;
336334
uint64_t number_of_cycles = adjusted_timestamp / CYCLE_SIZE;
337335

338-
// Compute transformed timestamp
339336
uint64_t transformed_timestamp = tst + CYCLE_SIZE * number_of_cycles + ITS_EPOCH_MS;
340337

341-
// Correct if transformed_timestamp is in the future
342338
if (transformed_timestamp > ref_utc_ms) {
343339
transformed_timestamp = tst + CYCLE_SIZE * (number_of_cycles - 1) + ITS_EPOCH_MS;
344340
}
345341

346-
// Split into seconds and milliseconds
347342
time_t abs_time = transformed_timestamp / 1000;
348343
uint32_t milliseconds = transformed_timestamp % 1000;
349344

350-
// Convert to UTC
351345
struct tm *timeinfo = gmtime(&abs_time);
352346
if (!timeinfo) {
353347
snprintf(buffer, sizeof(buffer), "Invalid time");

0 commit comments

Comments
 (0)