Use CLOCK_REALTIME to fix pcap timestamp issue (#78)

This commit is contained in:
mdulaney 2024-09-10 17:01:16 -04:00 committed by GitHub
parent e5e0ad941b
commit f009df6615
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -301,7 +301,7 @@ logpkt_pcap_write(const uint8_t *pkt, size_t pktsz, int fd)
pcap_rec_hdr_t rec_hdr;
struct timespec tv;
if (clock_gettime(CLOCK_MONOTONIC, &tv) == -1)
if (clock_gettime(CLOCK_REALTIME, &tv) == -1)
{
log_err_printf("Error getting current time: %s\n",
strerror(errno));

View File

@ -1017,7 +1017,7 @@ static void
sys_rand_seed(void) {
struct timespec seed;
if (clock_gettime(CLOCK_MONOTONIC, &seed) == -1) {
if (clock_gettime(CLOCK_REALTIME, &seed) == -1) {
srandom((unsigned)time(NULL));
} else {
srandom((unsigned)(seed.tv_sec ^ seed.tv_nsec));