diff options
| author | Chunyan Zhang <zhang.chunyan@linaro.org> | 2014-12-17 00:11:35 -0500 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2015-01-23 05:47:15 -0500 |
| commit | 41fbf3b39d5eca01527338b4d0ee15ee1ae1023c (patch) | |
| tree | fadcc3cc42eda258a31ec7d880f259d79f21063a | |
| parent | ec6f34e5b552fb0a52e6aae1a5afbbb1605cc6cc (diff) | |
ktime.h: Introduce ktime_ms_delta
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 <zhang.chunyan@linaro.org>
Acked-by: Arnd Bergmann <arnd@linaro.org>
Cc: zhang.lyra@gmail.com
Cc: davem@davemloft.net
Cc: john.stultz@linaro.org
Cc: dborkman@redhat.com
Link: http://lkml.kernel.org/r/1418793095-18780-1-git-send-email-zhang.chunyan@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
| -rw-r--r-- | include/linux/ktime.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index c9d645ad98ff..891ea92a68b0 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) | |||
| 186 | return ktime_to_us(ktime_sub(later, earlier)); | 186 | return ktime_to_us(ktime_sub(later, earlier)); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | static inline s64 ktime_ms_delta(const ktime_t later, const ktime_t earlier) | ||
| 190 | { | ||
| 191 | return ktime_to_ms(ktime_sub(later, earlier)); | ||
| 192 | } | ||
| 193 | |||
| 189 | static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec) | 194 | static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec) |
| 190 | { | 195 | { |
| 191 | return ktime_add_ns(kt, usec * NSEC_PER_USEC); | 196 | return ktime_add_ns(kt, usec * NSEC_PER_USEC); |
