mirror of
https://github.com/opnsense/src.git
synced 2026-02-25 11:00:15 -05:00
Use clock_gettime(CLOCK_SECOND) instead of gettimeofday(2) for
implementation of time(3). CLOCK_SECOND is much faster. No objections from: phk Submitted by: Valentin Nechayev <netch segfault kiev ua> MFC after: 1 week
This commit is contained in:
parent
30e7dc3c56
commit
358ed16f75
1 changed files with 3 additions and 4 deletions
|
|
@ -37,13 +37,12 @@ __FBSDID("$FreeBSD$");
|
|||
#include <sys/time.h>
|
||||
|
||||
time_t
|
||||
time(t)
|
||||
time_t *t;
|
||||
time(time_t *t)
|
||||
{
|
||||
struct timeval tt;
|
||||
struct timespec tt;
|
||||
time_t retval;
|
||||
|
||||
if (gettimeofday(&tt, (struct timezone *)0) < 0)
|
||||
if (clock_gettime(CLOCK_SECOND, &tt) < 0)
|
||||
retval = -1;
|
||||
else
|
||||
retval = tt.tv_sec;
|
||||
|
|
|
|||
Loading…
Reference in a new issue