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

GoogleCodeExporter opened this issue Mar 15, 2015 · 3 comments


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 by jonathan.skeet on 11 Nov 2012 at 9:18

Copy link

This issue was closed by revision b292cacd4988.

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

  • Changed state: Fixed

Copy link

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

    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

Copy link

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
None yet

No branches or pull requests

2 participants