Changeset 85208 in vbox
- Timestamp:
- Jul 10, 2020 11:58:39 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139184
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
r83484 r85208 32 32 #include "the-linux-kernel.h" 33 33 #include "internal/iprt.h" 34 /* Make sure we have the setting functions we need for RTTimeNow: */ 35 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) 36 # define RTTIME_INCL_TIMEVAL 37 #elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) 38 # define RTTIME_INCL_TIMESPEC 39 #endif 34 40 #include <iprt/time.h> 35 41 #include <iprt/asm.h> … … 183 189 { 184 190 IPRT_LINUX_SAVE_EFL_AC(); 185 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16) 186 /* On Linux 4.20, time.h includes time64.h and we have to use 64-bit times. */ 187 # ifdef _LINUX_TIME64_H 191 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) 188 192 struct timespec64 Ts; 189 ktime_get_real_ts64(&Ts); 190 # else 193 ktime_get_real_ts64(&Ts); /* ktime_get_real_ts64 was added as a macro in 3.17, function since 4.18. */ 194 IPRT_LINUX_RESTORE_EFL_AC(); 195 return RTTimeSpecSetTimespec64(pTime, &Ts); 196 197 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16) 191 198 struct timespec Ts; 192 ktime_get_real_ts(&Ts); 193 # endif 199 ktime_get_real_ts(&Ts); /* ktime_get_real_ts was removed in Linux 4.20. */ 194 200 IPRT_LINUX_RESTORE_EFL_AC(); 195 # ifdef _LINUX_TIME64_H196 return RTTimeSpecSetTimespec64(pTime, &Ts);197 # else198 201 return RTTimeSpecSetTimespec(pTime, &Ts); 199 # endif 200 #else 202 203 #else /* < 2.6.16 */ 201 204 struct timeval Tv; 202 205 do_gettimeofday(&Tv);
Note:
See TracChangeset
for help on using the changeset viewer.