@@ -179,7 +179,7 @@ impl<'cfg> Timings<'cfg> {
179
179
let unit_time = UnitTime {
180
180
unit,
181
181
target,
182
- start : d_as_f64 ( self . start . elapsed ( ) ) ,
182
+ start : self . start . elapsed ( ) . as_secs_f64 ( ) ,
183
183
duration : 0.0 ,
184
184
rmeta_time : None ,
185
185
unlocked_units : Vec :: new ( ) ,
@@ -200,7 +200,7 @@ impl<'cfg> Timings<'cfg> {
200
200
Some ( ut) => ut,
201
201
None => return ,
202
202
} ;
203
- let t = d_as_f64 ( self . start . elapsed ( ) ) ;
203
+ let t = self . start . elapsed ( ) . as_secs_f64 ( ) ;
204
204
unit_time. rmeta_time = Some ( t - unit_time. start ) ;
205
205
assert ! ( unit_time. unlocked_rmeta_units. is_empty( ) ) ;
206
206
unit_time
@@ -218,7 +218,7 @@ impl<'cfg> Timings<'cfg> {
218
218
Some ( ut) => ut,
219
219
None => return ,
220
220
} ;
221
- let t = d_as_f64 ( self . start . elapsed ( ) ) ;
221
+ let t = self . start . elapsed ( ) . as_secs_f64 ( ) ;
222
222
unit_time. duration = t - unit_time. start ;
223
223
assert ! ( unit_time. unlocked_units. is_empty( ) ) ;
224
224
unit_time
@@ -262,7 +262,7 @@ impl<'cfg> Timings<'cfg> {
262
262
return ;
263
263
}
264
264
let c = Concurrency {
265
- t : d_as_f64 ( self . start . elapsed ( ) ) ,
265
+ t : self . start . elapsed ( ) . as_secs_f64 ( ) ,
266
266
active,
267
267
waiting,
268
268
inactive,
@@ -305,7 +305,7 @@ impl<'cfg> Timings<'cfg> {
305
305
let pct_idle = current. idle_since ( prev) ;
306
306
* prev = current;
307
307
self . last_cpu_recording = now;
308
- let dur = d_as_f64 ( now. duration_since ( self . start ) ) ;
308
+ let dur = now. duration_since ( self . start ) . as_secs_f64 ( ) ;
309
309
self . cpu_usage . push ( ( dur, 100.0 - pct_idle) ) ;
310
310
}
311
311
@@ -334,7 +334,7 @@ impl<'cfg> Timings<'cfg> {
334
334
bcx : & BuildContext < ' _ , ' _ > ,
335
335
error : & Option < anyhow:: Error > ,
336
336
) -> CargoResult < ( ) > {
337
- let duration = d_as_f64 ( self . start . elapsed ( ) ) ;
337
+ let duration = self . start . elapsed ( ) . as_secs_f64 ( ) ;
338
338
let timestamp = self . start_str . replace ( & [ '-' , ':' ] [ ..] , "" ) ;
339
339
let filename = format ! ( "cargo-timing-{}.html" , timestamp) ;
340
340
let mut f = BufWriter :: new ( paths:: create ( & filename) ?) ;
@@ -616,11 +616,6 @@ impl UnitTime {
616
616
}
617
617
}
618
618
619
- // Replace with as_secs_f64 when 1.38 hits stable.
620
- fn d_as_f64 ( d : Duration ) -> f64 {
621
- ( d. as_secs ( ) as f64 ) + f64:: from ( d. subsec_nanos ( ) ) / 1_000_000_000.0
622
- }
623
-
624
619
fn render_rustc_info ( bcx : & BuildContext < ' _ , ' _ > ) -> String {
625
620
let version = bcx
626
621
. rustc ( )
0 commit comments