@@ -179,7 +179,7 @@ impl<'cfg> Timings<'cfg> {
179179 let unit_time = UnitTime {
180180 unit,
181181 target,
182- start : d_as_f64 ( self . start . elapsed ( ) ) ,
182+ start : self . start . elapsed ( ) . as_secs_f64 ( ) ,
183183 duration : 0.0 ,
184184 rmeta_time : None ,
185185 unlocked_units : Vec :: new ( ) ,
@@ -200,7 +200,7 @@ impl<'cfg> Timings<'cfg> {
200200 Some ( ut) => ut,
201201 None => return ,
202202 } ;
203- let t = d_as_f64 ( self . start . elapsed ( ) ) ;
203+ let t = self . start . elapsed ( ) . as_secs_f64 ( ) ;
204204 unit_time. rmeta_time = Some ( t - unit_time. start ) ;
205205 assert ! ( unit_time. unlocked_rmeta_units. is_empty( ) ) ;
206206 unit_time
@@ -218,7 +218,7 @@ impl<'cfg> Timings<'cfg> {
218218 Some ( ut) => ut,
219219 None => return ,
220220 } ;
221- let t = d_as_f64 ( self . start . elapsed ( ) ) ;
221+ let t = self . start . elapsed ( ) . as_secs_f64 ( ) ;
222222 unit_time. duration = t - unit_time. start ;
223223 assert ! ( unit_time. unlocked_units. is_empty( ) ) ;
224224 unit_time
@@ -262,7 +262,7 @@ impl<'cfg> Timings<'cfg> {
262262 return ;
263263 }
264264 let c = Concurrency {
265- t : d_as_f64 ( self . start . elapsed ( ) ) ,
265+ t : self . start . elapsed ( ) . as_secs_f64 ( ) ,
266266 active,
267267 waiting,
268268 inactive,
@@ -305,7 +305,7 @@ impl<'cfg> Timings<'cfg> {
305305 let pct_idle = current. idle_since ( prev) ;
306306 * prev = current;
307307 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 ( ) ;
309309 self . cpu_usage . push ( ( dur, 100.0 - pct_idle) ) ;
310310 }
311311
@@ -334,7 +334,7 @@ impl<'cfg> Timings<'cfg> {
334334 bcx : & BuildContext < ' _ , ' _ > ,
335335 error : & Option < anyhow:: Error > ,
336336 ) -> CargoResult < ( ) > {
337- let duration = d_as_f64 ( self . start . elapsed ( ) ) ;
337+ let duration = self . start . elapsed ( ) . as_secs_f64 ( ) ;
338338 let timestamp = self . start_str . replace ( & [ '-' , ':' ] [ ..] , "" ) ;
339339 let filename = format ! ( "cargo-timing-{}.html" , timestamp) ;
340340 let mut f = BufWriter :: new ( paths:: create ( & filename) ?) ;
@@ -616,11 +616,6 @@ impl UnitTime {
616616 }
617617}
618618
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-
624619fn render_rustc_info ( bcx : & BuildContext < ' _ , ' _ > ) -> String {
625620 let version = bcx
626621 . rustc ( )
0 commit comments