Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snapshots: improve verbose dump in count subcommands #2423

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

canepat
Copy link
Member

@canepat canepat commented Oct 15, 2024

No description provided.

Comment on lines 265 to +281
auto duration_as(const std::chrono::duration<R, P>& elapsed) {
return std::chrono::duration_cast<D>(elapsed).count();
}

//! Convert the given duration into milliseconds
//! \param elapsed the duration to convert
template <typename R, typename P>
auto as_milliseconds(const std::chrono::duration<R, P>& elapsed) {
return duration_as<std::chrono::milliseconds>(elapsed);
}

//! Convert the given duration into seconds
//! \param elapsed the duration to convert
template <typename R, typename P>
auto as_seconds(const std::chrono::duration<R, P>& elapsed) {
return duration_as<std::chrono::seconds>(elapsed);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After watching a talk on chrono I believe that this is not a proper usage of duration_cast. A better approach is to create a string format_duration(duration). I suggest to format it to seconds with ms fractional part e.g.: 12.455 sec

@canepat canepat marked this pull request as ready for review October 16, 2024 14:19
@canepat canepat added the snapshots Framework for BitTorrent-based snapshots label Oct 16, 2024
@canepat canepat merged commit bf785b0 into master Oct 16, 2024
7 checks passed
@canepat canepat deleted the cmd_snapshots_improve_verbose branch October 16, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
snapshots Framework for BitTorrent-based snapshots
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants