-/* $OpenBSD: authpf.c,v 1.125 2016/03/29 14:53:27 mestre Exp $ */
+/* $OpenBSD: authpf.c,v 1.126 2018/01/16 17:07:49 cheloha Exp $ */
/*
* Copyright (C) 1998 - 2007 Bob Beck (beck@openbsd.org).
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/stat.h>
-#include <sys/time.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
+#include <time.h>
#include <unistd.h>
#include "pathnames.h"
char ipsrc[256]; /* ip as a string */
char pidfile[PATH_MAX]; /* we save pid in this file. */
-struct timeval Tstart, Tend; /* start and end times of session */
+struct timespec Tstart, Tend; /* start and end times of session */
volatile sig_atomic_t want_death;
static void need_death(int signo);
goto error;
}
- gettimeofday(&Tstart, NULL);
+ clock_gettime(CLOCK_MONOTONIC, &Tstart);
syslog(LOG_INFO, "allowing %s, user %s", ipsrc, luser);
} else {
remove_stale_rulesets();
- gettimeofday(&Tend, NULL);
+ clock_gettime(CLOCK_MONOTONIC, &Tend);
syslog(LOG_INFO, "removed %s, user %s - duration %d seconds",
ipsrc, luser, (int)(Tend.tv_sec - Tstart.tv_sec));
}