This patch adds a reusable time difference function which returns the
difference in millisecond, as often used in some driver code, e.g.
mtd/test, media/rc, etc.
Signed-off-by: Chunyan Zhang <[email protected]>
---
include/linux/ktime.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index c9d645a..891ea92 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -186,6 +186,11 @@ static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier)
return ktime_to_us(ktime_sub(later, earlier));
}
+static inline s64 ktime_ms_delta(const ktime_t later, const ktime_t earlier)
+{
+ return ktime_to_ms(ktime_sub(later, earlier));
+}
+
static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec)
{
return ktime_add_ns(kt, usec * NSEC_PER_USEC);
--
1.7.9.5
On Wednesday 17 December 2014 13:11:35 Chunyan Zhang wrote:
> This patch adds a reusable time difference function which returns the
> difference in millisecond, as often used in some driver code, e.g.
> mtd/test, media/rc, etc.
>
> Signed-off-by: Chunyan Zhang <[email protected]>
Acked-by: Arnd Bergmann <[email protected]>
Very nice!