Add a few functions to ktime.h in the LinuxKPI, and fix nearby style.
Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11534
This commit is contained in:
parent
abf5c031bb
commit
7a2553d9d7
@ -26,8 +26,9 @@
|
|||||||
*
|
*
|
||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LINUX_KTIME_H
|
#ifndef _LINUX_KTIME_H
|
||||||
#define _LINUX_KTIME_H
|
#define _LINUX_KTIME_H
|
||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/time.h>
|
#include <linux/time.h>
|
||||||
@ -153,7 +154,7 @@ timeval_to_ktime(struct timeval tv)
|
|||||||
#define ktime_to_timeval(kt) ns_to_timeval((kt).tv64)
|
#define ktime_to_timeval(kt) ns_to_timeval((kt).tv64)
|
||||||
#define ktime_to_ns(kt) ((kt).tv64)
|
#define ktime_to_ns(kt) ((kt).tv64)
|
||||||
|
|
||||||
static inline s64
|
static inline int64_t
|
||||||
ktime_get_ns(void)
|
ktime_get_ns(void)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
@ -164,6 +165,8 @@ ktime_get_ns(void)
|
|||||||
return (ktime_to_ns(kt));
|
return (ktime_to_ns(kt));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define ktime_get_raw_ns() ktime_get_ns()
|
||||||
|
|
||||||
static inline ktime_t
|
static inline ktime_t
|
||||||
ktime_get(void)
|
ktime_get(void)
|
||||||
{
|
{
|
||||||
@ -173,4 +176,22 @@ ktime_get(void)
|
|||||||
return (timespec_to_ktime(ts));
|
return (timespec_to_ktime(ts));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _LINUX_KTIME_H */
|
static inline ktime_t
|
||||||
|
ktime_get_boottime(void)
|
||||||
|
{
|
||||||
|
struct timespec ts;
|
||||||
|
|
||||||
|
nanouptime(&ts);
|
||||||
|
return (timespec_to_ktime(ts));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline ktime_t
|
||||||
|
ktime_get_real(void)
|
||||||
|
{
|
||||||
|
struct timespec ts;
|
||||||
|
|
||||||
|
nanotime(&ts);
|
||||||
|
return (timespec_to_ktime(ts));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _LINUX_KTIME_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user