diff options
author | Matteo Croce <mcroce@redhat.com> | 2018-07-31 18:03:32 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-08-16 19:36:55 +0200 |
commit | 14d32b2525dd3a21c29b0d9edf1748f5dabc1bbc (patch) | |
tree | dd9366dfc5a35b2fb889bd4ead02b206b4e228ed /include/linux/jiffies.h | |
parent | a53b42c11815d2357e31a9403ae3950517525894 (diff) | |
download | linux-stable-14d32b2525dd3a21c29b0d9edf1748f5dabc1bbc.tar.gz linux-stable-14d32b2525dd3a21c29b0d9edf1748f5dabc1bbc.tar.bz2 linux-stable-14d32b2525dd3a21c29b0d9edf1748f5dabc1bbc.zip |
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 <eric.dumazet@gmail.com>
Signed-off-by: Matteo Croce <mcroce@redhat.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/linux/jiffies.h')
-rw-r--r-- | include/linux/jiffies.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index a27cf6652327..fa928242567d 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); |