Skip to content

Allow to add and subtract durations from Utc #13

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

Closed
ChristopherRabotin opened this issue Dec 31, 2017 · 1 comment
Closed

Allow to add and subtract durations from Utc #13

ChristopherRabotin opened this issue Dec 31, 2017 · 1 comment
Assignees

Comments

@ChristopherRabotin
Copy link
Member

This should return another Utc. This will be needed to support loops over time, such as:

let mut current = Utc::new(/*...*/);
let end =  Utc::new(/*...*/);
while current < end {
/* do stuff */
    current += std::time::Duration(1, 0) // Or current += 1*SECOND
}

Eventually also include in this PR some short cuts such as:

hifitime::constants::{DAY, HOUR, MINUTE, SECOND, MICROSECOND, NANOSECOND};

Note that these short cut will need to support multiplications with floats and unsigned integers to make it useful. This may require some custom implementation such as hifitime::StdDuration::from_hours() or hifitime::StdDuration::from_seconds(10). I am pretty sure I cannot just use hifitime::Duration since it's re-exported.

@ChristopherRabotin
Copy link
Member Author

There's currently a basic from_hours implementation which will be made obsolete if and once rust-lang/rust#47097 is merged.

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

No branches or pull requests

1 participant