diff -Naur a/vboxdrv/include/iprt/time.h b/vboxdrv/include/iprt/time.h
|
a
|
b
|
|
| 366 | 366 | * @param pTime The time spec to interpret. |
| 367 | 367 | * @param pTimeval Where to store the time as POSIX timeval. |
| 368 | 368 | */ |
| | 369 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 99) |
| 369 | 370 | DECLINLINE(struct timeval *) RTTimeSpecGetTimeval(PCRTTIMESPEC pTime, struct timeval *pTimeval) |
| 370 | 371 | { |
| 371 | 372 | int64_t i64 = RTTimeSpecGetMicro(pTime); |
| … |
… |
|
| 392 | 393 | { |
| 393 | 394 | return RTTimeSpecAddMicro(RTTimeSpecSetSeconds(pTime, pTimeval->tv_sec), pTimeval->tv_usec); |
| 394 | 395 | } |
| | 396 | #endif |
| 395 | 397 | #endif /* various ways of detecting struct timeval */ |
| 396 | 398 | |
| 397 | 399 | |
| 398 | 400 | /* PORTME: Add struct timespec guard macro here. */ |
| 399 | 401 | #if defined(RTTIME_INCL_TIMESPEC) || defined(_STRUCT_TIMESPEC) || defined(_SYS__TIMESPEC_H_) || defined(TIMEVAL_TO_TIMESPEC) || defined(_TIMESPEC) \ |
| 400 | 402 | || (defined(RT_OS_NETBSD) && defined(_SYS_TIME_H_)) |
| | 403 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 99) |
| 401 | 404 | /** |
| 402 | 405 | * Gets the time as POSIX timespec. |
| 403 | 406 | * |
| … |
… |
|
| 431 | 434 | { |
| 432 | 435 | return RTTimeSpecAddNano(RTTimeSpecSetSeconds(pTime, pTimespec->tv_sec), pTimespec->tv_nsec); |
| 433 | 436 | } |
| | 437 | #endif |
| 434 | 438 | |
| 435 | 439 | |
| | 440 | #endif /* various ways of detecting struct timespec */ |
| | 441 | |
| 436 | 442 | # ifdef _LINUX_TIME64_H |
| 437 | 443 | DECLINLINE(PRTTIMESPEC) RTTimeSpecSetTimespec64(PRTTIMESPEC pTime, const struct timespec64 *pTimeval) |
| 438 | 444 | { |
| 439 | 445 | return RTTimeSpecAddNano(RTTimeSpecSetSeconds(pTime, pTimeval->tv_sec), pTimeval->tv_nsec); |
| 440 | 446 | } |
| 441 | | # endif |
| 442 | | #endif /* various ways of detecting struct timespec */ |
| 443 | | |
| | 447 | #endif |
| 444 | 448 | |
| 445 | 449 | |
| 446 | 450 | /** The offset of the unix epoch and the base for NT time (in 100ns units). |
diff -Naur a/vboxdrv/r0drv/linux/time-r0drv-linux.c b/vboxdrv/r0drv/linux/time-r0drv-linux.c
|
a
|
b
|
|
| 43 | 43 | * Use ktime_get_ts, this is also what clock_gettime(CLOCK_MONOTONIC,) is using. |
| 44 | 44 | */ |
| 45 | 45 | uint64_t u64; |
| 46 | | struct timespec Ts; |
| 47 | | ktime_get_ts(&Ts); |
| | 46 | struct timespec64 Ts; |
| | 47 | ktime_get_ts64(&Ts); |
| 48 | 48 | u64 = Ts.tv_sec * RT_NS_1SEC_64 + Ts.tv_nsec; |
| 49 | 49 | return u64; |
| 50 | 50 | |
diff -Naur a/vboxnetadp/include/iprt/time.h b/vboxnetadp/include/iprt/time.h
|
a
|
b
|
|
| 366 | 366 | * @param pTime The time spec to interpret. |
| 367 | 367 | * @param pTimeval Where to store the time as POSIX timeval. |
| 368 | 368 | */ |
| | 369 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 99) |
| 369 | 370 | DECLINLINE(struct timeval *) RTTimeSpecGetTimeval(PCRTTIMESPEC pTime, struct timeval *pTimeval) |
| 370 | 371 | { |
| 371 | 372 | int64_t i64 = RTTimeSpecGetMicro(pTime); |
| … |
… |
|
| 392 | 393 | { |
| 393 | 394 | return RTTimeSpecAddMicro(RTTimeSpecSetSeconds(pTime, pTimeval->tv_sec), pTimeval->tv_usec); |
| 394 | 395 | } |
| | 396 | #endif |
| 395 | 397 | #endif /* various ways of detecting struct timeval */ |
| 396 | 398 | |
| 397 | 399 | |
| 398 | 400 | /* PORTME: Add struct timespec guard macro here. */ |
| 399 | 401 | #if defined(RTTIME_INCL_TIMESPEC) || defined(_STRUCT_TIMESPEC) || defined(_SYS__TIMESPEC_H_) || defined(TIMEVAL_TO_TIMESPEC) || defined(_TIMESPEC) \ |
| 400 | 402 | || (defined(RT_OS_NETBSD) && defined(_SYS_TIME_H_)) |
| | 403 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 99) |
| 401 | 404 | /** |
| 402 | 405 | * Gets the time as POSIX timespec. |
| 403 | 406 | * |
| … |
… |
|
| 431 | 434 | { |
| 432 | 435 | return RTTimeSpecAddNano(RTTimeSpecSetSeconds(pTime, pTimespec->tv_sec), pTimespec->tv_nsec); |
| 433 | 436 | } |
| | 437 | #endif |
| 434 | 438 | |
| 435 | 439 | |
| | 440 | #endif /* various ways of detecting struct timespec */ |
| | 441 | |
| 436 | 442 | # ifdef _LINUX_TIME64_H |
| 437 | 443 | DECLINLINE(PRTTIMESPEC) RTTimeSpecSetTimespec64(PRTTIMESPEC pTime, const struct timespec64 *pTimeval) |
| 438 | 444 | { |
| 439 | 445 | return RTTimeSpecAddNano(RTTimeSpecSetSeconds(pTime, pTimeval->tv_sec), pTimeval->tv_nsec); |
| 440 | 446 | } |
| 441 | | # endif |
| 442 | | #endif /* various ways of detecting struct timespec */ |
| 443 | | |
| | 447 | #endif |
| 444 | 448 | |
| 445 | 449 | |
| 446 | 450 | /** The offset of the unix epoch and the base for NT time (in 100ns units). |
diff -Naur a/vboxnetflt/include/iprt/time.h b/vboxnetflt/include/iprt/time.h
|
a
|
b
|
|
| 366 | 366 | * @param pTime The time spec to interpret. |
| 367 | 367 | * @param pTimeval Where to store the time as POSIX timeval. |
| 368 | 368 | */ |
| | 369 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 99) |
| 369 | 370 | DECLINLINE(struct timeval *) RTTimeSpecGetTimeval(PCRTTIMESPEC pTime, struct timeval *pTimeval) |
| 370 | 371 | { |
| 371 | 372 | int64_t i64 = RTTimeSpecGetMicro(pTime); |
| … |
… |
|
| 392 | 393 | { |
| 393 | 394 | return RTTimeSpecAddMicro(RTTimeSpecSetSeconds(pTime, pTimeval->tv_sec), pTimeval->tv_usec); |
| 394 | 395 | } |
| | 396 | #endif |
| 395 | 397 | #endif /* various ways of detecting struct timeval */ |
| 396 | 398 | |
| 397 | 399 | |
| 398 | 400 | /* PORTME: Add struct timespec guard macro here. */ |
| 399 | 401 | #if defined(RTTIME_INCL_TIMESPEC) || defined(_STRUCT_TIMESPEC) || defined(_SYS__TIMESPEC_H_) || defined(TIMEVAL_TO_TIMESPEC) || defined(_TIMESPEC) \ |
| 400 | 402 | || (defined(RT_OS_NETBSD) && defined(_SYS_TIME_H_)) |
| | 403 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 99) |
| 401 | 404 | /** |
| 402 | 405 | * Gets the time as POSIX timespec. |
| 403 | 406 | * |
| … |
… |
|
| 431 | 434 | { |
| 432 | 435 | return RTTimeSpecAddNano(RTTimeSpecSetSeconds(pTime, pTimespec->tv_sec), pTimespec->tv_nsec); |
| 433 | 436 | } |
| | 437 | #endif |
| 434 | 438 | |
| 435 | 439 | |
| | 440 | #endif /* various ways of detecting struct timespec */ |
| | 441 | |
| 436 | 442 | # ifdef _LINUX_TIME64_H |
| 437 | 443 | DECLINLINE(PRTTIMESPEC) RTTimeSpecSetTimespec64(PRTTIMESPEC pTime, const struct timespec64 *pTimeval) |
| 438 | 444 | { |
| 439 | 445 | return RTTimeSpecAddNano(RTTimeSpecSetSeconds(pTime, pTimeval->tv_sec), pTimeval->tv_nsec); |
| 440 | 446 | } |
| 441 | | # endif |
| 442 | | #endif /* various ways of detecting struct timespec */ |
| 443 | | |
| | 447 | #endif |
| 444 | 448 | |
| 445 | 449 | |
| 446 | 450 | /** The offset of the unix epoch and the base for NT time (in 100ns units). |