Implement the ktime_compare() and ktime_after() functions in the LinuxKPI.

Submitted by:	Johannes Lundberg <johalun0@gmail.com>
MFC after:	1 week
Sponsored by:	Mellanox Technologies
Sponsored by:	Limelight Networks
This commit is contained in:
Hans Petter Selasky 2018-06-06 13:37:31 +00:00
parent a16387c1d4
commit 9e067b2256

View File

@ -127,6 +127,25 @@ ktime_add(ktime_t lhs, ktime_t rhs)
return (lhs + rhs);
}
static inline int
ktime_compare(const ktime_t cmp1, const ktime_t cmp2)
{
if (cmp1 > cmp2)
return (1);
else if (cmp1 < cmp2)
return (-1);
else
return (0);
}
static inline bool
ktime_after(const ktime_t cmp1, const ktime_t cmp2)
{
return (ktime_compare(cmp1, cmp2) > 0);
}
static inline ktime_t
timespec_to_ktime(struct timespec ts)
{