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
The text was updated successfully, but these errors were encountered:
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
Original issue reported on code.google.com by
jonathan.skeet
on 11 Nov 2012 at 9:18The text was updated successfully, but these errors were encountered: