Skip to content

Commit 5fcfc91

Browse files
committed
sqlite: Remove debug output, finish epoch ass.
Remove some debug out, as the last commit of removing the epoch assumption. There is no need to worry about the time. The issue I tried to solve, was that for example the real boot time could be one second less than the original boot time. This can happen if for example the uptime and timeofday is read at different seconds. One second is not important for us, there is a higher latency in when we discover that a network is down for example. Our goal with the DB calculation is to shift the time offset to that of the boot time. This is done by doing (timestamp - orig_boot_time) + real_boot_time, for all timestamps less than real_boot_time. If real_boot_time is less than orig_boot_time, then the statement has no effect. This is ok, as we input absolute time in the database. The code is meant to handle large differences in time, for example from epoch or some default rtc value. And that works fine.
1 parent 108f06d commit 5fcfc91

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

metadata_writer_sqlite.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,11 @@ static int md_sqlite_read_boot_time(struct md_writer_sqlite *mws, uint64_t *boot
309309
gettimeofday(&tv, NULL);
310310

311311
*boot_time = tv.tv_sec - uptime;
312-
META_PRINT_SYSLOG(mws->parent, LOG_INFO, "%" PRIu64 " %ld %" PRIu64 "\n", *boot_time, tv.tv_sec, uptime);
312+
313+
if (*boot_time < mws->orig_boot_time) {
314+
return RETVAL_FAILURE;
315+
}
316+
313317
return RETVAL_SUCCESS;
314318
}
315319

0 commit comments

Comments
 (0)