mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
wolfcrypt/src/wc_port.c LINUXKM time(): use ktime_get_coarse_real_ts64 instead of ktime_get_real_seconds, to avoid GPL-only function, and fix the calculation in the kernel 3.x codepath.
This commit is contained in:
@@ -2438,9 +2438,11 @@ time_t time(time_t * timer)
|
|||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
getnstimeofday(&ts);
|
getnstimeofday(&ts);
|
||||||
ret = ts.tv_sec * 1000000000LL + ts.tv_nsec;
|
ret = ts.tv_sec;
|
||||||
#else
|
#else
|
||||||
ret = ktime_get_real_seconds();
|
struct timespec64 ts;
|
||||||
|
ktime_get_coarse_real_ts64(&ts);
|
||||||
|
ret = ts.tv_sec;
|
||||||
#endif
|
#endif
|
||||||
if (timer)
|
if (timer)
|
||||||
*timer = ret;
|
*timer = ret;
|
||||||
|
Reference in New Issue
Block a user