about summary refs log tree commit diff
path: root/compiler/rustc_data_structures
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2020-09-20 10:27:14 +0200
committerest31 <MTest31@outlook.com>2020-09-20 10:27:14 +0200
commit43193dcb882466163436057e50c96bb74d9bf50f (patch)
treef4d1135a59118c947806a0ce6d5dc12cd19129fa /compiler/rustc_data_structures
parentcebbd9fcd35a63569b8fb5c836b5a26089861c41 (diff)
downloadrust-43193dcb882466163436057e50c96bb74d9bf50f.tar.gz
rust-43193dcb882466163436057e50c96bb74d9bf50f.zip
Use as_secs_f64 in profiling.rs
Diffstat (limited to 'compiler/rustc_data_structures')
-rw-r--r--compiler/rustc_data_structures/src/profiling.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs
index 07d16c6483e..363879cbb1d 100644
--- a/compiler/rustc_data_structures/src/profiling.rs
+++ b/compiler/rustc_data_structures/src/profiling.rs
@@ -600,10 +600,7 @@ pub fn print_time_passes_entry(do_it: bool, what: &str, dur: Duration) {
 // Hack up our own formatting for the duration to make it easier for scripts
 // to parse (always use the same number of decimal places and the same unit).
 pub fn duration_to_secs_str(dur: std::time::Duration) -> String {
-    const NANOS_PER_SEC: f64 = 1_000_000_000.0;
-    let secs = dur.as_secs() as f64 + dur.subsec_nanos() as f64 / NANOS_PER_SEC;
-
-    format!("{:.3}", secs)
+    format!("{:.3}", dur.as_secs_f64())
 }
 
 // Memory reporting