Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move duration_to_secs_str to rustc_session
- Loading branch information
1 parent
984c74a
commit 4351698
Showing
3 changed files
with
11 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod cgu_reuse_tracker; | ||
pub mod utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// 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) | ||
} |