Skip to content

Switch to using Duration with HiffyContext#672

Merged
labbott merged 2 commits into
masterfrom
labbott/use_a_duration
May 21, 2026
Merged

Switch to using Duration with HiffyContext#672
labbott merged 2 commits into
masterfrom
labbott/use_a_duration

Conversation

@labbott
Copy link
Copy Markdown
Contributor

@labbott labbott commented May 20, 2026

This makes it much clearer for eventually doing humility as a library. There's not a nice way to have clap automatically parse a duration but we can at least change all the arguments to be a u64 to easily pass to Duration.

@labbott labbott force-pushed the labbott/use_a_duration branch from 151462c to 4558793 Compare May 20, 2026 20:09
@labbott labbott requested review from hawkw and mkeeter May 20, 2026 20:09
@labbott labbott force-pushed the labbott/use_a_duration branch from 4558793 to ae7ac7d Compare May 20, 2026 20:14
Comment thread cmd/auxflash/src/lib.rs
let hubris = &context.cli.archive()?;
let core = &mut *context.cli.attach_live_booted(hubris)?;
let mut worker = AuxFlashHandler::new(hubris, core, subargs.timeout)?;
let timeout = std::time::Duration::from_millis(subargs.timeout);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i suppose the alternative to this could be to write a wrapper type which has a FromStr implementation that parses an integer and then Duration::from_millises it, but...meh. This seems fine.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I had the same thought, and the same "...meh" reaction

Comment thread cmd/console-proxy/src/posix.rs Outdated
Comment on lines +41 to +42
hiffy_timeout: u64,
poll_interval: u64,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

personally I feel like maybe we ought to accept these as Durations here and make the caller do that, but maybe it's annoyinger that way?

@labbott labbott force-pushed the labbott/use_a_duration branch from ae7ac7d to 0721b97 Compare May 21, 2026 13:04
This makes it much clearer for eventually doing humility as a
library. There's not a nice way to have clap automatically
parse a duration but we can at least change all the arguments
to be a `u64` to easily pass to Duration.
@labbott labbott force-pushed the labbott/use_a_duration branch from 0721b97 to b2ffffc Compare May 21, 2026 13:04
@labbott labbott enabled auto-merge (rebase) May 21, 2026 14:08
@labbott labbott merged commit cfbf850 into master May 21, 2026
12 checks passed
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.

3 participants