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

Decide whether Duration.OneMinute (etc) should exist #70

Closed
GoogleCodeExporter opened this Issue Mar 15, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@GoogleCodeExporter

GoogleCodeExporter commented Mar 15, 2015

Currently, Duration exposes a bunch of canned fields like Zero, OneMinute, 
NegativeOneTick, and so on.  It also exposes sensible operator overloads and 
factory methods, meaning that it's unclear as to whether 'a duration of three 
days' should be best constructed via:

Duration.FromStandardDays(3)
or
Duration.OneStandardDay * 3

I suggest that we pick one, and I'd tend toward the factory methods, rather 
than trying to provide a bunch of fields for 'common but not really' durations.

Alternatively, we should remove the factory methods (apart from FromTimeSpan()) 
and rationalise the common durations (removing NegativeOneTick in favour of 
-OneTick and adding OneStandardWeek).  But I'd prefer the former, I think.

Original issue reported on code.google.com by malcolm.rowe on 20 Apr 2012 at 1:47

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Mar 15, 2015

Oh, forgot to mention: Duration.Zero (and probably MinValue and MaxValue) do 
make sense, regardless of what we decide above.

Original comment by malcolm.rowe on 20 Apr 2012 at 1:48

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Mar 15, 2015

Agreed, let's get rid of at least most of the constants. Zero makes sense, and 
*potentially* OneTick as an equivalent of Epsilon to some extent. Maybe 
MinValue and MaxValue? OneWeek etc should go.

Original comment by jonsk...@google.com on 23 Apr 2012 at 8:31

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Mar 15, 2015

Fixed in revision 0cf928ea05d7.

We could also now decide to make e.g. FromStandardWeeks(1) return the 
OneStandardWeek constant (etc), but that's an optimisation we can do later if 
at all.

Original comment by malcolm.rowe on 23 Apr 2012 at 11:00

  • Changed state: Fixed

@malcolmr malcolmr added the bug label Mar 15, 2015

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