From: Matteo Croce Date: Tue, 31 Jul 2018 16:03:32 +0000 (+0200) Subject: jiffies: add utility function to calculate delta in ms X-Git-Tag: v4.19-rc1~86^2~7^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=14d32b2525dd3a21c29b0d9edf1748f5dabc1bbc;p=thirdparty%2Fkernel%2Flinux.git jiffies: add utility function to calculate delta in ms add jiffies_delta_to_msecs() helper func to calculate the delta between two times and eventually 0 if negative. Suggested-by: Eric Dumazet Signed-off-by: Matteo Croce Reviewed-by: Eric Dumazet Acked-by: Simon Horman Signed-off-by: Pablo Neira Ayuso --- diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index a27cf66523279..fa928242567db 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h @@ -447,6 +447,11 @@ static inline clock_t jiffies_delta_to_clock_t(long delta) return jiffies_to_clock_t(max(0L, delta)); } +static inline unsigned int jiffies_delta_to_msecs(long delta) +{ + return jiffies_to_msecs(max(0L, delta)); +} + extern unsigned long clock_t_to_jiffies(unsigned long x); extern u64 jiffies_64_to_clock_t(u64 x); extern u64 nsec_to_clock_t(u64 x);