Linux_5.0: replace do_gettimeofday with ktime_get_real_ts64
[openafs.git] / src / afs / LINUX / osi_machdep.h
index a1a2f57..6832c3e 100644 (file)
@@ -92,9 +92,15 @@ static inline time_t osi_Time(void) {
 # define osi_Time() (xtime.tv_sec)
 #endif
 
-
-
-#ifdef AFS_LINUX_64BIT_KERNEL
+#if defined(HAVE_LINUX_KTIME_GET_REAL_TS64)
+# define osi_GetTime(V)                                      \
+    do {                                                     \
+       struct timespec64 __afs_tv;                          \
+       ktime_get_real_ts64(&__afs_tv);                      \
+       (V)->tv_sec = (afs_int32)__afs_tv.tv_sec;            \
+       (V)->tv_usec = (afs_int32)__afs_tv.tv_nsec / 1000;   \
+    } while(0)
+#elif defined(AFS_LINUX_64BIT_KERNEL)
 # define osi_GetTime(V)                                 \
     do {                                               \
        struct timeval __afs_tv;                              \