File tree 3 files changed +11
-8
lines changed 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 15
15
unused
16
16
) ]
17
17
18
- #![ feature( std_misc) ]
18
+ #![ feature( std_misc, duration ) ]
19
19
20
20
extern crate term;
21
21
Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ fn oneshot_timer(dur: Duration) -> Receiver<()> {
26
26
let ( tx, rx) = mpsc:: channel ( ) ;
27
27
28
28
thread:: spawn ( move || {
29
- thread:: sleep_ms ( dur. num_milliseconds ( ) as u32 ) ;
29
+ let time = dur. secs ( ) * 1000 + dur. extra_nanos ( ) as u64 / 1000 ;
30
+ thread:: sleep_ms ( time as u32 ) ;
30
31
31
32
tx. send ( ( ) ) . unwrap ( ) ;
32
33
} ) ;
@@ -48,7 +49,7 @@ impl PromptThread {
48
49
prompt. set_path ( p) ;
49
50
50
51
loop {
51
- let timeout = oneshot_timer ( Duration :: minutes ( 10 ) ) ;
52
+ let timeout = oneshot_timer ( Duration :: from_secs ( 10 * 60 ) ) ;
52
53
53
54
select ! {
54
55
_ = rx_notify. recv( ) => {
@@ -99,7 +100,7 @@ impl PromptThread {
99
100
100
101
self . send . send ( ( ) ) . unwrap ( ) ;
101
102
102
- let timeout = oneshot_timer ( Duration :: milliseconds ( 100 ) ) ;
103
+ let timeout = oneshot_timer ( Duration :: from_millis ( 100 ) ) ;
103
104
104
105
loop {
105
106
let resp = self . recv . try_recv ( ) ;
Original file line number Diff line number Diff line change 14
14
path_ext,
15
15
std_misc,
16
16
metadata_ext,
17
- path_relative_from
17
+ path_relative_from,
18
+ duration
18
19
) ]
19
20
20
21
extern crate term;
@@ -154,8 +155,9 @@ fn do_daemon(socket_path: &Path) {
154
155
fn oneshot_timer ( dur : Duration ) -> Receiver < ( ) > {
155
156
let ( tx, rx) = mpsc:: channel ( ) ;
156
157
157
- let _ = thread:: spawn ( move || {
158
- thread:: sleep_ms ( dur. num_milliseconds ( ) as u32 ) ;
158
+ thread:: spawn ( move || {
159
+ let time = dur. secs ( ) * 1000 + dur. extra_nanos ( ) as u64 / 1000 ;
160
+ thread:: sleep_ms ( time as u32 ) ;
159
161
160
162
tx. send ( ( ) ) . unwrap ( ) ;
161
163
} ) ;
@@ -230,7 +232,7 @@ fn do_main(socket_path: &Path) {
230
232
write ! ( & mut stream, "{}" , env:: current_dir( ) . unwrap( ) . display( ) ) . unwrap ( ) ;
231
233
stream. shutdown ( Shutdown :: Write ) . unwrap ( ) ;
232
234
233
- match read_with_timeout ( stream, Duration :: milliseconds ( 200 ) ) {
235
+ match read_with_timeout ( stream, Duration :: from_millis ( 200 ) ) {
234
236
Ok ( s) => println ! ( "{}" , s) ,
235
237
Err ( _) => {
236
238
println ! ( "Response too slow" ) ;
You can’t perform that action at this time.
0 commit comments