-
Notifications
You must be signed in to change notification settings - Fork 21
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
humantime serde #811
humantime serde #811
Conversation
.poll_duration(settings.reward_check_interval()) | ||
.offset(settings.reward_check_interval() * 2) | ||
.lookback(LookbackBehavior::StartAfter(settings.start_after)) | ||
.poll_duration(reward_check_interval) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file_info_poller takes a chrono Duration, just to turn it into a std Duration, maybe we should just change it to accept a std Duration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes good sense to me. Also because it doesn't make sense for file info poller to need to support negative time deltas.
a293d8b
to
3d416e9
Compare
prefer std::time::Duration when possible
std::Durations were being turned into chrono::Durations only to be turned right back into std::Durations. It also doesn't make much sense for the file poller to support negative time deltas, so we can remove that possibility.
3d416e9
to
47f2f65
Compare
Bring Durations and DateTimes into alignment across settings.
Companion Ops PR: https://github.com/novalabsxyz/ops/pull/1348
A Bit about
Duration
When possible
std::time::Duration
was preferred in place ofchrono::Duration
.If there was a duration or timestamp comparison that looked like negative Durations could be in play
chrono::Duration
was left. (In future chrono versions they've renamedchrono::Duration
tochrono::TimeDelta
with the thinking thatDuration
implies only positive time.)There are also some tests with
chrono::Duration
is left in because the constructors added readability.There's a current nightly only feature that will add some of these constructors to
std::time::Duration
rust-lang/rust#120301.u(hhhh)nwrap()
???In an attempt to make default duration settings easier to understand, I used
humantime::format_duration
which returns a result. These are only used in serde default functions.