From 4c41694e6b6c94b10ab80d06f888604f26fd34be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?= Date: Thu, 15 Apr 2021 12:22:23 +0300 Subject: [PATCH] time: add getter for Interval's period (#3701) --- tokio/src/time/interval.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tokio/src/time/interval.rs b/tokio/src/time/interval.rs index 20cfceccce3..4b1c6f6dfda 100644 --- a/tokio/src/time/interval.rs +++ b/tokio/src/time/interval.rs @@ -176,4 +176,9 @@ impl Interval { // Return the current instant Poll::Ready(now) } + + /// Returns the period of the interval. + pub fn period(&self) -> Duration { + self.period + } }