diff mbox series

[net,v2,1/2] jiffies: add utility function to calculate delta in ms

Message ID 20180731160333.12215-2-mcroce@redhat.com
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show
Series fix glitch in IPVS /proc handlers | expand

Commit Message

Matteo Croce July 31, 2018, 4:03 p.m. UTC
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>
---
 include/linux/jiffies.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Eric Dumazet July 31, 2018, 4:07 p.m. UTC | #1
On 07/31/2018 09:03 AM, Matteo Croce wrote:
> 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>

Thanks.
diff mbox series

Patch

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);