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

Creating a LocalTime from a TimeSpan should be simpler than it is #148

Closed
GoogleCodeExporter opened this issue Mar 15, 2015 · 3 comments
Closed
Milestone

Comments

@GoogleCodeExporter
Copy link

While a TimeSpan really *isn't* a time of day, bits of the BCL treat it that 
way. It would be appropriate to have LocalTime.FromTimeSpan with appropriate 
caveats, and also LocalTime.FromTicksSinceMidnight and 
LocalTime.FromSecondsSinceMidnight. The current workaround is:

    LocalTime.Midnight + Period.FromTicks(ticks)

which is pretty nasty.

Original issue reported on code.google.com by jonathan.skeet on 11 Nov 2012 at 9:18

@GoogleCodeExporter
Copy link
Author

This issue was closed by revision b292cacd4988.

Original comment by jonathan.skeet on 11 Nov 2012 at 9:47

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Now we've got FromTicksSinceMidnight, using a TimeSpan is fairly 
straightforward:

    LocalTime time = LocalTime.FromTicksSinceMidnight(timeSpan.Ticks);

That's not terribly unpleasant, and it avoids polluting Noda Time with a 
conversion which isn't sensible for the *normal* meaning of TimeSpan.

Original comment by jonathan.skeet on 11 Nov 2012 at 9:48

@GoogleCodeExporter
Copy link
Author

Original comment by malcolm.rowe on 30 Jan 2013 at 11:19

  • Added labels: Type-Enhancement, Milestone-1.1.0

@malcolmr malcolmr modified the milestone: 1.1.0 Mar 15, 2015
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

2 participants