Skip to content

Conversation

@Riateche
Copy link
Contributor

@Riateche Riateche commented Jul 11, 2025

Summary

  • Add DurationUs
  • Make inner field private
  • Add all necessary methods for working with them
  • Add more conversions to other types

Rationale

To simplify the code, make it more robust and make checked operations on timestamps easier.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

Tested with lazer tests as well.

@vercel
Copy link

vercel bot commented Jul 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 14, 2025 2:03pm
component-library ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 14, 2025 2:03pm
developer-hub ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 14, 2025 2:03pm
entropy-debugger ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 14, 2025 2:03pm
entropy-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 14, 2025 2:03pm
insights ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 14, 2025 2:03pm
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 14, 2025 2:03pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 14, 2025 2:03pm

pub fn is_multiple_of(self, other: DurationUs) -> bool {
match self.0.checked_rem(other.0) {
Some(rem) => rem == 0,
None => false,
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't 0 a multiple of any number?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants