File tree Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change
1
+ ## tentacle 0.6.4
2
+
3
+ ## Feature
4
+ - Make ` runtime::Interval ` behavior same as tokio interval(#379 )
5
+
1
6
## tentacle 0.6.3
2
7
3
8
## Bug Fix
Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " tentacle"
3
- version = " 0.6.3 "
3
+ version = " 0.6.4 "
4
4
license = " MIT"
5
5
description = " Minimal implementation for a multiplexed p2p network framework."
6
6
authors = [" piaoliu <driftluo@foxmail.com>" , " Nervos Core Dev <dev@nervos.org>" ]
Original file line number Diff line number Diff line change @@ -14,9 +14,15 @@ pub struct Interval {
14
14
}
15
15
16
16
impl Interval {
17
+ /// Same as tokio::time::interval
17
18
pub fn new ( period : Duration ) -> Self {
19
+ Self :: new_at ( Duration :: ZERO , period)
20
+ }
21
+
22
+ /// Same as tokio::time::interval_at
23
+ pub fn new_at ( start_since_now : Duration , period : Duration ) -> Self {
18
24
Self {
19
- delay : Delay :: new ( period ) ,
25
+ delay : Delay :: new ( start_since_now ) ,
20
26
period,
21
27
}
22
28
}
Original file line number Diff line number Diff line change @@ -33,8 +33,14 @@ mod time {
33
33
pub struct Interval ( Inner ) ;
34
34
35
35
impl Interval {
36
+ /// Same as tokio::time::interval
36
37
pub fn new ( period : Duration ) -> Self {
37
- Self ( inner_interval ( Instant :: now ( ) + period, period) )
38
+ Self :: new_at ( Duration :: ZERO , period)
39
+ }
40
+
41
+ /// Same as tokio::time::interval_at
42
+ pub fn new_at ( start_since_now : Duration , period : Duration ) -> Self {
43
+ Self ( inner_interval ( Instant :: now ( ) + start_since_now, period) )
38
44
}
39
45
40
46
pub fn set_missed_tick_behavior ( & mut self , behavior : MissedTickBehavior ) {
You can’t perform that action at this time.
0 commit comments