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

Add a conversion from Period to Duration #55

Closed
GoogleCodeExporter opened this issue Mar 15, 2015 · 1 comment
Closed

Add a conversion from Period to Duration #55

GoogleCodeExporter opened this issue Mar 15, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

@GoogleCodeExporter GoogleCodeExporter commented Mar 15, 2015

Periods which only contain fixed-length fields should be convertible to 
Duration, in a way which assumes a day is only ever 24 hours:

    // This will only use time fields, which are okay
    Period period = Period.Between(time1, time2);
    Duration duration = period.ToDuration();

Original issue reported on code.google.com by jonathan.skeet on 18 Apr 2012 at 6:04

@GoogleCodeExporter
Copy link
Author

@GoogleCodeExporter GoogleCodeExporter commented Mar 15, 2015

Fixed in revision a23d9bd19a89.

Note that this will throw InvalidOperationException if you try to call 
ToDuration on a period with months or years.

Original comment by jonathan.skeet on 19 Apr 2012 at 8:06

  • Changed state: Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant