One case I can image is to use negative value for forever duration? ---- Da (Klaus), Ma (马达) | PMP® | Advisory Software Engineer Platform OpenSource Technology, STG, IBM GCG +86-10-8245 4084 | [email protected] | http://k82.me
On Wed, Mar 9, 2016 at 8:21 PM, Alex Rukletsov <[email protected]> wrote: > Folks, > > I've recently realized that durations we use in mesos (stout's `Duration` > and `DurationInfo` protobuf) are based on signed integers. Negative > duration concept is a bit strange to me, so I googled around a bit and > found an interesting thread [1]. > > Was it an explicit intention to allow `Duration`s to be negative? Do we use > this feature? If yes, maybe we can introduce a class representing time > delta (can be negative) and base `Duration` on top of it guaranteeing it is > always non-negative? > > My ultimate intention is to avoid boilerplate code that validates every > single instance of `Duration` in the codebase. I'd rather have a class with > guarantees certain invariants. > > [1] https://internals.rust-lang.org/t/unsigned-version-of-duration/893/2 >
